pitit refact

This commit is contained in:
Paul Schneider 2026-06-04 12:13:37 +01:00
commit 20713eef64
235 changed files with 5374 additions and 373 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,193 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Yavsc.Migrations
{
/// <inheritdoc />
public partial class pending : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RegexAlertPatterns",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Pattern = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
Description = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Severity = table.Column<int>(type: "integer", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RegexAlertPatterns", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TrustTokens",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TokenHash = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
TokenSource = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
TrustScore = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TrustTokens", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TrustDeclarations",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TrustTokenId = table.Column<Guid>(type: "uuid", nullable: false),
DeclarantTokenId = table.Column<Guid>(type: "uuid", nullable: false),
Content = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
Sentiment = table.Column<int>(type: "integer", nullable: false),
SubmittedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
ScoreDelta = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TrustDeclarations", x => x.Id);
table.ForeignKey(
name: "FK_TrustDeclarations_TrustTokens_TrustTokenId",
column: x => x.TrustTokenId,
principalTable: "TrustTokens",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DeclarationFlag",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DeclarationId = table.Column<long>(type: "bigint", nullable: false),
PatternId = table.Column<int>(type: "integer", nullable: false),
MatchExcerpt = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DeclarationFlag", x => x.Id);
table.ForeignKey(
name: "FK_DeclarationFlag_RegexAlertPatterns_PatternId",
column: x => x.PatternId,
principalTable: "RegexAlertPatterns",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DeclarationFlag_TrustDeclarations_DeclarationId",
column: x => x.DeclarationId,
principalTable: "TrustDeclarations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ModerationLogs",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DeclarationId = table.Column<long>(type: "bigint", nullable: false),
ModeratorId = table.Column<string>(type: "text", nullable: true),
Action = table.Column<int>(type: "integer", nullable: false),
ScoreDelta = table.Column<int>(type: "integer", nullable: false),
Timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ModerationLogs", x => x.Id);
table.CheckConstraint("CK_ModerationLog_Immutable", "1=1");
table.ForeignKey(
name: "FK_ModerationLogs_TrustDeclarations_DeclarationId",
column: x => x.DeclarationId,
principalTable: "TrustDeclarations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_DeclarationFlag_DeclarationId",
table: "DeclarationFlag",
column: "DeclarationId");
migrationBuilder.CreateIndex(
name: "IX_DeclarationFlag_PatternId",
table: "DeclarationFlag",
column: "PatternId");
migrationBuilder.CreateIndex(
name: "IX_ModerationLogs_DeclarationId",
table: "ModerationLogs",
column: "DeclarationId");
migrationBuilder.CreateIndex(
name: "IX_ModerationLogs_ModeratorId",
table: "ModerationLogs",
column: "ModeratorId");
migrationBuilder.CreateIndex(
name: "IX_ModerationLogs_Timestamp",
table: "ModerationLogs",
column: "Timestamp");
migrationBuilder.CreateIndex(
name: "IX_RegexAlertPatterns_IsActive",
table: "RegexAlertPatterns",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_TrustDeclarations_Status",
table: "TrustDeclarations",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_TrustDeclarations_SubmittedAt",
table: "TrustDeclarations",
column: "SubmittedAt");
migrationBuilder.CreateIndex(
name: "IX_TrustDeclarations_TrustTokenId",
table: "TrustDeclarations",
column: "TrustTokenId");
migrationBuilder.CreateIndex(
name: "IX_TrustTokens_TokenHash",
table: "TrustTokens",
column: "TokenHash",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeclarationFlag");
migrationBuilder.DropTable(
name: "ModerationLogs");
migrationBuilder.DropTable(
name: "RegexAlertPatterns");
migrationBuilder.DropTable(
name: "TrustDeclarations");
migrationBuilder.DropTable(
name: "TrustTokens");
}
}
}

View file

@ -17,7 +17,7 @@ namespace Yavsc.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.HasAnnotation("ProductVersion", "10.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -2170,6 +2170,171 @@ namespace Yavsc.Migrations
b.ToTable("DeviceDeclaration");
});
modelBuilder.Entity("Yavsc.Models.Kyc.DeclarationFlag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long>("DeclarationId")
.HasColumnType("bigint");
b.Property<string>("MatchExcerpt")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("PatternId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DeclarationId");
b.HasIndex("PatternId");
b.ToTable("DeclarationFlag");
});
modelBuilder.Entity("Yavsc.Models.Kyc.ModerationLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<int>("Action")
.HasColumnType("integer");
b.Property<long>("DeclarationId")
.HasColumnType("bigint");
b.Property<string>("ModeratorId")
.HasColumnType("text");
b.Property<int>("ScoreDelta")
.HasColumnType("integer");
b.Property<DateTime>("Timestamp")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DeclarationId");
b.HasIndex("ModeratorId");
b.HasIndex("Timestamp");
b.ToTable("ModerationLogs", t =>
{
t.HasCheckConstraint("CK_ModerationLog_Immutable", "1=1");
});
});
modelBuilder.Entity("Yavsc.Models.Kyc.RegexAlertPattern", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Pattern")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int>("Severity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("RegexAlertPatterns");
});
modelBuilder.Entity("Yavsc.Models.Kyc.TrustDeclaration", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Content")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<Guid>("DeclarantTokenId")
.HasColumnType("uuid");
b.Property<int?>("ScoreDelta")
.HasColumnType("integer");
b.Property<int>("Sentiment")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<DateTime>("SubmittedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("TrustTokenId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("Status");
b.HasIndex("SubmittedAt");
b.HasIndex("TrustTokenId");
b.ToTable("TrustDeclarations");
});
modelBuilder.Entity("Yavsc.Models.Kyc.TrustToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("TokenHash")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("TokenSource")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<int?>("TrustScore")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TokenHash")
.IsUnique();
b.ToTable("TrustTokens");
});
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.Property<long>("Id")
@ -3838,6 +4003,47 @@ namespace Yavsc.Migrations
b.Navigation("DeviceOwner");
});
modelBuilder.Entity("Yavsc.Models.Kyc.DeclarationFlag", b =>
{
b.HasOne("Yavsc.Models.Kyc.TrustDeclaration", "Declaration")
.WithMany("Flags")
.HasForeignKey("DeclarationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yavsc.Models.Kyc.RegexAlertPattern", "Pattern")
.WithMany()
.HasForeignKey("PatternId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Declaration");
b.Navigation("Pattern");
});
modelBuilder.Entity("Yavsc.Models.Kyc.ModerationLog", b =>
{
b.HasOne("Yavsc.Models.Kyc.TrustDeclaration", "Declaration")
.WithMany()
.HasForeignKey("DeclarationId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Declaration");
});
modelBuilder.Entity("Yavsc.Models.Kyc.TrustDeclaration", b =>
{
b.HasOne("Yavsc.Models.Kyc.TrustToken", "Subject")
.WithMany("Declarations")
.HasForeignKey("TrustTokenId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Subject");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Workflow.Activity", "Context")
@ -4303,6 +4509,16 @@ namespace Yavsc.Migrations
b.Navigation("Taints");
});
modelBuilder.Entity("Yavsc.Models.Kyc.TrustDeclaration", b =>
{
b.Navigation("Flags");
});
modelBuilder.Entity("Yavsc.Models.Kyc.TrustToken", b =>
{
b.Navigation("Declarations");
});
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.DjSettings", b =>
{
b.Navigation("SoundColor");