[FA-misc] Saga seems to work, fixed a UserNovelDataService bug

This commit is contained in:
gamer147
2026-01-28 12:11:06 -05:00
parent 579e05b853
commit ec967770d3
34 changed files with 1341 additions and 97 deletions

View File

@@ -0,0 +1,76 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace FictionArchive.Service.NovelService.Migrations
{
/// <inheritdoc />
public partial class AddNovelImportSaga : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ActiveImports",
columns: table => new
{
ImportId = table.Column<Guid>(type: "uuid", nullable: false),
NovelUrl = table.Column<string>(type: "text", nullable: false),
StartedAt = table.Column<Instant>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ActiveImports", x => x.ImportId);
});
migrationBuilder.CreateTable(
name: "NovelImportSagaStates",
columns: table => new
{
CorrelationId = table.Column<Guid>(type: "uuid", nullable: false),
CurrentState = table.Column<string>(type: "text", nullable: false),
NovelUrl = table.Column<string>(type: "text", nullable: false),
NovelId = table.Column<long>(type: "bigint", nullable: true),
ExpectedChapters = table.Column<int>(type: "integer", nullable: false),
CompletedChapters = table.Column<int>(type: "integer", nullable: false),
ExpectedImages = table.Column<int>(type: "integer", nullable: false),
CompletedImages = table.Column<int>(type: "integer", nullable: false),
StartedAt = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
CompletedAt = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
ErrorMessage = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NovelImportSagaStates", x => x.CorrelationId);
});
migrationBuilder.CreateIndex(
name: "IX_ActiveImports_NovelUrl",
table: "ActiveImports",
column: "NovelUrl",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NovelImportSagaStates_CurrentState",
table: "NovelImportSagaStates",
column: "CurrentState");
migrationBuilder.CreateIndex(
name: "IX_NovelImportSagaStates_NovelUrl",
table: "NovelImportSagaStates",
column: "NovelUrl");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ActiveImports");
migrationBuilder.DropTable(
name: "NovelImportSagaStates");
}
}
}