🗃️ Add account relationships

This commit is contained in:
2025-04-16 01:16:35 +08:00
parent 701a5d3882
commit cec8c3af81
8 changed files with 764 additions and 15 deletions

View File

@ -221,6 +221,41 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("account_profiles", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b =>
{
b.Property<long>("FromAccountId")
.HasColumnType("bigint")
.HasColumnName("from_account_id");
b.Property<long>("ToAccountId")
.HasColumnType("bigint")
.HasColumnName("to_account_id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("FromAccountId", "ToAccountId")
.HasName("pk_account_relationships");
b.HasIndex("ToAccountId")
.HasDatabaseName("ix_account_relationships_to_account_id");
b.ToTable("account_relationships", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b =>
{
b.Property<Guid>("Id")
@ -474,6 +509,27 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Picture");
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "FromAccount")
.WithMany("OutgoingRelationships")
.HasForeignKey("FromAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_account_relationships_accounts_from_account_id");
b.HasOne("DysonNetwork.Sphere.Account.Account", "ToAccount")
.WithMany("IncomingRelationships")
.HasForeignKey("ToAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_account_relationships_accounts_to_account_id");
b.Navigation("FromAccount");
b.Navigation("ToAccount");
});
modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
@ -527,6 +583,10 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Contacts");
b.Navigation("IncomingRelationships");
b.Navigation("OutgoingRelationships");
b.Navigation("Profile")
.IsRequired();