Receipt governance activity in Bifrost

This commit is contained in:
Meta Vens 2026-06-17 05:21:29 +01:00
commit cab9d22f78
15 changed files with 2600 additions and 3 deletions

View file

@ -59,6 +59,8 @@ public sealed class BifrostDbContext(DbContextOptions<BifrostDbContext> options)
public DbSet<AgentTransportReceipt> AgentTransportReceipts => Set<AgentTransportReceipt>();
public DbSet<GovernanceActivityReceipt> GovernanceActivityReceipts => Set<GovernanceActivityReceipt>();
public DbSet<AuditEvent> AuditEvents => Set<AuditEvent>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -475,6 +477,26 @@ public sealed class BifrostDbContext(DbContextOptions<BifrostDbContext> options)
.OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<GovernanceActivityReceipt>(entity =>
{
entity.Property(x => x.TopicId).HasMaxLength(120);
entity.Property(x => x.CommentId).HasMaxLength(120);
entity.Property(x => x.DispatchRequestId).HasMaxLength(240);
entity.Property(x => x.Title).HasMaxLength(240);
entity.Property(x => x.JurisdictionRepoName).HasMaxLength(120);
entity.Property(x => x.JurisdictionAgentIdentity).HasMaxLength(160);
entity.Property(x => x.ActivityKind).HasConversion<string>();
entity.Property(x => x.ActorKind).HasMaxLength(40);
entity.Property(x => x.ActorName).HasMaxLength(160);
entity.HasIndex(x => x.TopicId);
entity.HasIndex(x => x.OccurredAtUtc);
entity.HasIndex(x => new { x.JurisdictionRepoName, x.JurisdictionAgentIdentity, x.ActivityKind });
entity.HasOne(x => x.ActorUserAccount)
.WithMany(x => x.GovernanceActivityReceipts)
.HasForeignKey(x => x.ActorUserAccountId)
.OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<AuditEvent>(entity =>
{
entity.Property(x => x.EntityType).HasMaxLength(120);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bifrost.Web.Data.Migrations
{
/// <inheritdoc />
public partial class AddGovernanceActivityReceipts : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GovernanceActivityReceipts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TopicId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
CommentId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
DispatchRequestId = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
Title = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
JurisdictionRepoName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
JurisdictionAgentIdentity = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
ActivityKind = table.Column<string>(type: "text", nullable: false),
ActorKind = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
ActorName = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
Note = table.Column<string>(type: "text", nullable: false),
ActorUserAccountId = table.Column<Guid>(type: "uuid", nullable: true),
OccurredAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GovernanceActivityReceipts", x => x.Id);
table.ForeignKey(
name: "FK_GovernanceActivityReceipts_UserAccounts_ActorUserAccountId",
column: x => x.ActorUserAccountId,
principalTable: "UserAccounts",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_GovernanceActivityReceipts_ActorUserAccountId",
table: "GovernanceActivityReceipts",
column: "ActorUserAccountId");
migrationBuilder.CreateIndex(
name: "IX_GovernanceActivityReceipts_JurisdictionRepoName_Jurisdictio~",
table: "GovernanceActivityReceipts",
columns: new[] { "JurisdictionRepoName", "JurisdictionAgentIdentity", "ActivityKind" });
migrationBuilder.CreateIndex(
name: "IX_GovernanceActivityReceipts_OccurredAtUtc",
table: "GovernanceActivityReceipts",
column: "OccurredAtUtc");
migrationBuilder.CreateIndex(
name: "IX_GovernanceActivityReceipts_TopicId",
table: "GovernanceActivityReceipts",
column: "TopicId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GovernanceActivityReceipts");
}
}
}

View file

@ -494,6 +494,79 @@ namespace Bifrost.Web.Data.Migrations
b.ToTable("GitHubPullRequestLinks");
});
modelBuilder.Entity("Bifrost.Web.Domain.GovernanceActivityReceipt", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ActivityKind")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ActorKind")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("character varying(40)");
b.Property<string>("ActorName")
.IsRequired()
.HasMaxLength(160)
.HasColumnType("character varying(160)");
b.Property<Guid?>("ActorUserAccountId")
.HasColumnType("uuid");
b.Property<string>("CommentId")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("DispatchRequestId")
.IsRequired()
.HasMaxLength(240)
.HasColumnType("character varying(240)");
b.Property<string>("JurisdictionAgentIdentity")
.IsRequired()
.HasMaxLength(160)
.HasColumnType("character varying(160)");
b.Property<string>("JurisdictionRepoName")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("OccurredAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(240)
.HasColumnType("character varying(240)");
b.Property<string>("TopicId")
.IsRequired()
.HasMaxLength(120)
.HasColumnType("character varying(120)");
b.HasKey("Id");
b.HasIndex("ActorUserAccountId");
b.HasIndex("OccurredAtUtc");
b.HasIndex("TopicId");
b.HasIndex("JurisdictionRepoName", "JurisdictionAgentIdentity", "ActivityKind");
b.ToTable("GovernanceActivityReceipts");
});
modelBuilder.Entity("Bifrost.Web.Domain.LedgerEntry", b =>
{
b.Property<Guid>("Id")
@ -1509,6 +1582,16 @@ namespace Bifrost.Web.Data.Migrations
b.Navigation("WorkItem");
});
modelBuilder.Entity("Bifrost.Web.Domain.GovernanceActivityReceipt", b =>
{
b.HasOne("Bifrost.Web.Domain.UserAccount", "ActorUserAccount")
.WithMany("GovernanceActivityReceipts")
.HasForeignKey("ActorUserAccountId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ActorUserAccount");
});
modelBuilder.Entity("Bifrost.Web.Domain.LedgerEntry", b =>
{
b.HasOne("Bifrost.Web.Domain.UserAccount", "CreatedByUserAccount")
@ -1900,6 +1983,8 @@ namespace Bifrost.Web.Data.Migrations
b.Navigation("CreatedMotions");
b.Navigation("GovernanceActivityReceipts");
b.Navigation("LedgerEntries");
b.Navigation("MemberProfile");