Publisher API

This commit is contained in:
2025-04-19 14:41:34 +08:00
parent f9701764f3
commit 0e3b88c51c
15 changed files with 2105 additions and 26 deletions

View File

@ -386,6 +386,247 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("auth_sessions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Content")
.HasColumnType("text")
.HasColumnName("content");
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<string>("Description")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("description");
b.Property<int>("Downvotes")
.HasColumnType("integer")
.HasColumnName("downvotes");
b.Property<long?>("ForwardedPostId")
.HasColumnType("bigint")
.HasColumnName("forwarded_post_id");
b.Property<long>("PublisherId")
.HasColumnType("bigint")
.HasColumnName("publisher_id");
b.Property<long?>("RepliedPostId")
.HasColumnType("bigint")
.HasColumnName("replied_post_id");
b.Property<string>("Title")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("title");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<int>("Upvotes")
.HasColumnType("integer")
.HasColumnName("upvotes");
b.Property<int>("ViewsTotal")
.HasColumnType("integer")
.HasColumnName("views_total");
b.Property<int>("ViewsUnique")
.HasColumnType("integer")
.HasColumnName("views_unique");
b.HasKey("Id")
.HasName("pk_posts");
b.HasIndex("ForwardedPostId")
.HasDatabaseName("ix_posts_forwarded_post_id");
b.HasIndex("PublisherId")
.HasDatabaseName("ix_posts_publisher_id");
b.HasIndex("RepliedPostId")
.HasDatabaseName("ix_posts_replied_post_id");
b.ToTable("posts", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property<int>("Attitude")
.HasColumnType("integer")
.HasColumnName("attitude");
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<long>("PostId")
.HasColumnType("bigint")
.HasColumnName("post_id");
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("symbol");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_post_reactions");
b.HasIndex("AccountId")
.HasDatabaseName("ix_post_reactions_account_id");
b.HasIndex("PostId")
.HasDatabaseName("ix_post_reactions_post_id");
b.ToTable("post_reactions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long?>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property<string>("BackgroundId")
.HasColumnType("text")
.HasColumnName("background_id");
b.Property<string>("Bio")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("bio");
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<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("name");
b.Property<string>("Nick")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("nick");
b.Property<string>("PictureId")
.HasColumnType("text")
.HasColumnName("picture_id");
b.Property<int>("PublisherType")
.HasColumnType("integer")
.HasColumnName("publisher_type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_publishers");
b.HasIndex("AccountId")
.HasDatabaseName("ix_publishers_account_id");
b.HasIndex("BackgroundId")
.HasDatabaseName("ix_publishers_background_id");
b.HasIndex("PictureId")
.HasDatabaseName("ix_publishers_picture_id");
b.ToTable("publishers", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b =>
{
b.Property<long>("PublisherId")
.HasColumnType("bigint")
.HasColumnName("publisher_id");
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("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<Instant?>("JoinedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("joined_at");
b.Property<int>("Role")
.HasColumnType("integer")
.HasColumnName("role");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("PublisherId", "AccountId")
.HasName("pk_publisher_members");
b.HasIndex("AccountId")
.HasDatabaseName("ix_publisher_members_account_id");
b.ToTable("publisher_members", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b =>
{
b.Property<string>("Id")
@ -429,6 +670,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(1024)")
.HasColumnName("name");
b.Property<long?>("PostId")
.HasColumnType("bigint")
.HasColumnName("post_id");
b.Property<long>("Size")
.HasColumnType("bigint")
.HasColumnName("size");
@ -460,6 +705,9 @@ namespace DysonNetwork.Sphere.Migrations
b.HasIndex("AccountId")
.HasDatabaseName("ix_files_account_id");
b.HasIndex("PostId")
.HasDatabaseName("ix_files_post_id");
b.ToTable("files", (string)null);
});
@ -567,6 +815,100 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Challenge");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b =>
{
b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost")
.WithMany()
.HasForeignKey("ForwardedPostId")
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("fk_posts_posts_forwarded_post_id");
b.HasOne("DysonNetwork.Sphere.Post.Publisher", "Publisher")
.WithMany("Posts")
.HasForeignKey("PublisherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_posts_publishers_publisher_id");
b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost")
.WithMany()
.HasForeignKey("RepliedPostId")
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("fk_posts_posts_replied_post_id");
b.Navigation("ForwardedPost");
b.Navigation("Publisher");
b.Navigation("RepliedPost");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany()
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_post_reactions_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Post.Post", "Post")
.WithMany("Reactions")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_post_reactions_posts_post_id");
b.Navigation("Account");
b.Navigation("Post");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany()
.HasForeignKey("AccountId")
.HasConstraintName("fk_publishers_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background")
.WithMany()
.HasForeignKey("BackgroundId")
.HasConstraintName("fk_publishers_files_background_id");
b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture")
.WithMany()
.HasForeignKey("PictureId")
.HasConstraintName("fk_publishers_files_picture_id");
b.Navigation("Account");
b.Navigation("Background");
b.Navigation("Picture");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany()
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_publisher_members_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Post.Publisher", "Publisher")
.WithMany("Members")
.HasForeignKey("PublisherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_publisher_members_publishers_publisher_id");
b.Navigation("Account");
b.Navigation("Publisher");
});
modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
@ -576,6 +918,11 @@ namespace DysonNetwork.Sphere.Migrations
.IsRequired()
.HasConstraintName("fk_files_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
.WithMany("Attachments")
.HasForeignKey("PostId")
.HasConstraintName("fk_files_posts_post_id");
b.Navigation("Account");
});
@ -596,6 +943,20 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Sessions");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b =>
{
b.Navigation("Attachments");
b.Navigation("Reactions");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
{
b.Navigation("Members");
b.Navigation("Posts");
});
#pragma warning restore 612, 618
}
}