Post category tags subscriptions

This commit is contained in:
2025-08-25 14:18:14 +08:00
parent 75c92c51db
commit d5157eb7e3
7 changed files with 2390 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddPostCategoryTagSubscription : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "post_category_subscriptions",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
category_id = table.Column<Guid>(type: "uuid", nullable: true),
tag_id = table.Column<Guid>(type: "uuid", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_post_category_subscriptions", x => x.id);
table.ForeignKey(
name: "fk_post_category_subscriptions_post_categories_category_id",
column: x => x.category_id,
principalTable: "post_categories",
principalColumn: "id");
table.ForeignKey(
name: "fk_post_category_subscriptions_post_tags_tag_id",
column: x => x.tag_id,
principalTable: "post_tags",
principalColumn: "id");
});
migrationBuilder.CreateIndex(
name: "ix_post_category_subscriptions_category_id",
table: "post_category_subscriptions",
column: "category_id");
migrationBuilder.CreateIndex(
name: "ix_post_category_subscriptions_tag_id",
table: "post_category_subscriptions",
column: "tag_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "post_category_subscriptions");
}
}
}

View File

@@ -695,6 +695,49 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("post_categories", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategorySubscription", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("AccountId")
.HasColumnType("uuid")
.HasColumnName("account_id");
b.Property<Guid?>("CategoryId")
.HasColumnType("uuid")
.HasColumnName("category_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<Guid?>("TagId")
.HasColumnType("uuid")
.HasColumnName("tag_id");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_post_category_subscriptions");
b.HasIndex("CategoryId")
.HasDatabaseName("ix_post_category_subscriptions_category_id");
b.HasIndex("TagId")
.HasDatabaseName("ix_post_category_subscriptions_tag_id");
b.ToTable("post_category_subscriptions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
{
b.Property<Guid>("Id")
@@ -1727,6 +1770,23 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("RepliedPost");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategorySubscription", b =>
{
b.HasOne("DysonNetwork.Sphere.Post.PostCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.HasConstraintName("fk_post_category_subscriptions_post_categories_category_id");
b.HasOne("DysonNetwork.Sphere.Post.PostTag", "Tag")
.WithMany()
.HasForeignKey("TagId")
.HasConstraintName("fk_post_category_subscriptions_post_tags_tag_id");
b.Navigation("Category");
b.Navigation("Tag");
});
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
{
b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher")