Add the projection persistence and the two services around it:
- Projection.ReadModel: a shared EF Core (Npgsql) read model owning the projection
schema — register_projection + the subscriber's processed_notifications log — plus
EfProjectionStore / EfNotificationLog (atomic record-or-skip on the PK for idempotency)
and the initial migration. One rebuildable store, written by the subscriber and read
by projection-api (ADR-0008).
- EventSubscriber.Api: POST /notifications NRC callback (enforces the abonnement bearer,
401 without it per ADR-0007), POST /admin/rebuild, /health. Migrates on start.
- ProjectionApi.Api: GET /register, GET /register/{id}, /health — the read side.
dotnet-ef pinned as a local tool for migrations; NuGetAuditMode=direct so EF's
design-time-only tooling transitive doesn't flag the shipped build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Projection.ReadModel.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialProjection : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "processed_notifications",
|
|
columns: table => new
|
|
{
|
|
key = table.Column<string>(type: "text", nullable: false),
|
|
actie = table.Column<string>(type: "text", nullable: false),
|
|
zaak_id = table.Column<string>(type: "text", nullable: false),
|
|
received_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_processed_notifications", x => x.key);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "register_projection",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<string>(type: "text", nullable: false),
|
|
status = table.Column<string>(type: "text", nullable: false),
|
|
bsn = table.Column<string>(type: "text", nullable: true),
|
|
naam_placeholder = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_register_projection", x => x.id);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "processed_notifications");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "register_projection");
|
|
}
|
|
}
|
|
}
|