Realm tags and discovery

This commit is contained in:
2025-06-26 19:00:55 +08:00
parent f170793928
commit d492c9ce1f
12 changed files with 4220 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
using System;
using DysonNetwork.Sphere.Connection.WebReader;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddRealmTags : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<WebFeedConfig>(
name: "config",
table: "web_feeds",
type: "jsonb",
nullable: false);
migrationBuilder.CreateTable(
name: "tags",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
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_tags", x => x.id);
});
migrationBuilder.CreateTable(
name: "realm_tags",
columns: table => new
{
realm_id = table.Column<Guid>(type: "uuid", nullable: false),
tag_id = table.Column<Guid>(type: "uuid", nullable: false),
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_realm_tags", x => new { x.realm_id, x.tag_id });
table.ForeignKey(
name: "fk_realm_tags_realms_realm_id",
column: x => x.realm_id,
principalTable: "realms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_realm_tags_tags_tag_id",
column: x => x.tag_id,
principalTable: "tags",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_realm_tags_tag_id",
table: "realm_tags",
column: "tag_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "realm_tags");
migrationBuilder.DropTable(
name: "tags");
migrationBuilder.DropColumn(
name: "config",
table: "web_feeds");
}
}
}

View File

@ -1438,6 +1438,11 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<WebFeedConfig>("Config")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("config");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
@ -2359,6 +2364,68 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("realm_members", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b =>
{
b.Property<Guid>("RealmId")
.HasColumnType("uuid")
.HasColumnName("realm_id");
b.Property<Guid>("TagId")
.HasColumnType("uuid")
.HasColumnName("tag_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>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("RealmId", "TagId")
.HasName("pk_realm_tags");
b.HasIndex("TagId")
.HasDatabaseName("ix_realm_tags_tag_id");
b.ToTable("realm_tags", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("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<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("name");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_tags");
b.ToTable("tags", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b =>
{
b.Property<Guid>("Id")
@ -3573,6 +3640,27 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Realm");
});
modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b =>
{
b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm")
.WithMany("RealmTags")
.HasForeignKey("RealmId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_realm_tags_realms_realm_id");
b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag")
.WithMany("RealmTags")
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_realm_tags_tags_tag_id");
b.Navigation("Realm");
b.Navigation("Tag");
});
modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b =>
{
b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack")
@ -3837,6 +3925,13 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("ChatRooms");
b.Navigation("Members");
b.Navigation("RealmTags");
});
modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b =>
{
b.Navigation("RealmTags");
});
modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b =>