mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
- VendorAccessToken model + unique-index migration; TokenLifetimeDays config - VendorPortalTokenService: CSPRNG token generation, rotation, revocation - VendorPortalController: public portal API guarded by X-Vendor-Token header; dispatches list/detail, accept, vendor status transitions, cancel request, checklist updates, signoffs (vendor + customer), comments with dispatcher attribution via AspNetUsers join - VendorController: portal-token admin endpoints (get / rotate / revoke) - WorkOrderController: dispatch email now uses vendor portal URL and HTML-encodes user fields; AddDispatchComment now stores CommentType='dispatcher' with the SHOC user's name so portal can attribute the author - DispatchPublicController: deprecated per-dispatch GET accept flow returns a static 'link no longer active' page (no state mutation)
64 lines
2.8 KiB
C#
64 lines
2.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Data.SeaHavenIndustries.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddVendorAccessToken : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "VendorAccessTokens",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
VendorId = table.Column<int>(type: "int", nullable: false),
|
|
Token = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
IssuedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
RevokedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastUsedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: true),
|
|
createdby = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DeleterUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastModifierUserId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_VendorAccessTokens", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_VendorAccessTokens_Vendors_VendorId",
|
|
column: x => x.VendorId,
|
|
principalTable: "Vendors",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VendorAccessTokens_Token",
|
|
table: "VendorAccessTokens",
|
|
column: "Token",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VendorAccessTokens_VendorId",
|
|
table: "VendorAccessTokens",
|
|
column: "VendorId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "VendorAccessTokens");
|
|
}
|
|
}
|
|
}
|