⚗️ Activity pub

This commit is contained in:
2025-12-28 18:08:35 +08:00
parent f06d93a348
commit 2471fa2e75
27 changed files with 6506 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,350 @@
using System;
using System.Collections.Generic;
using DysonNetwork.Shared.Models;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddActivityPub : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Dictionary<string, object>>(
name: "meta",
table: "publishers",
type: "jsonb",
nullable: true);
migrationBuilder.CreateTable(
name: "fediverse_instances",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
domain = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
name = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
software = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
version = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
metadata = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
is_blocked = table.Column<bool>(type: "boolean", nullable: false),
is_silenced = table.Column<bool>(type: "boolean", nullable: false),
block_reason = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
last_fetched_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
last_activity_at = table.Column<Instant>(type: "timestamp with time zone", 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_fediverse_instances", x => x.id);
});
migrationBuilder.CreateTable(
name: "fediverse_actors",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
username = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
display_name = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
bio = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
inbox_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
outbox_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
followers_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
following_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
featured_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
public_key_id = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
public_key = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: true),
metadata = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
avatar_url = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
header_url = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
is_bot = table.Column<bool>(type: "boolean", nullable: false),
is_locked = table.Column<bool>(type: "boolean", nullable: false),
is_discoverable = table.Column<bool>(type: "boolean", nullable: false),
instance_id = table.Column<Guid>(type: "uuid", nullable: false),
last_fetched_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
last_activity_at = table.Column<Instant>(type: "timestamp with time zone", 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_fediverse_actors", x => x.id);
table.ForeignKey(
name: "fk_fediverse_actors_fediverse_instances_instance_id",
column: x => x.instance_id,
principalTable: "fediverse_instances",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_contents",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
type = table.Column<int>(type: "integer", nullable: false),
title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
summary = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
content = table.Column<string>(type: "text", nullable: true),
content_html = table.Column<string>(type: "text", nullable: true),
language = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
in_reply_to = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
announced_content_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
is_sensitive = table.Column<bool>(type: "boolean", nullable: false),
attachments = table.Column<List<ContentAttachment>>(type: "jsonb", nullable: true),
mentions = table.Column<List<ContentMention>>(type: "jsonb", nullable: true),
tags = table.Column<List<ContentTag>>(type: "jsonb", nullable: true),
emojis = table.Column<List<ContentEmoji>>(type: "jsonb", nullable: true),
metadata = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
instance_id = table.Column<Guid>(type: "uuid", nullable: false),
reply_count = table.Column<int>(type: "integer", nullable: false),
boost_count = table.Column<int>(type: "integer", nullable: false),
like_count = table.Column<int>(type: "integer", nullable: false),
local_post_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_fediverse_contents", x => x.id);
table.ForeignKey(
name: "fk_fediverse_contents_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_contents_fediverse_instances_instance_id",
column: x => x.instance_id,
principalTable: "fediverse_instances",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_relationships",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
target_actor_id = table.Column<Guid>(type: "uuid", nullable: false),
state = table.Column<int>(type: "integer", nullable: false),
is_following = table.Column<bool>(type: "boolean", nullable: false),
is_followed_by = table.Column<bool>(type: "boolean", nullable: false),
is_muting = table.Column<bool>(type: "boolean", nullable: false),
is_blocking = table.Column<bool>(type: "boolean", nullable: false),
followed_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
followed_back_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
reject_reason = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
is_local_actor = table.Column<bool>(type: "boolean", nullable: false),
local_account_id = table.Column<Guid>(type: "uuid", nullable: true),
local_publisher_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_fediverse_relationships", x => x.id);
table.ForeignKey(
name: "fk_fediverse_relationships_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_relationships_fediverse_actors_target_actor_id",
column: x => x.target_actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_activities",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
type = table.Column<int>(type: "integer", nullable: false),
object_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
target_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
is_local = table.Column<bool>(type: "boolean", nullable: false),
raw_data = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
content_id = table.Column<Guid>(type: "uuid", nullable: true),
target_actor_id = table.Column<Guid>(type: "uuid", nullable: true),
local_post_id = table.Column<Guid>(type: "uuid", nullable: true),
local_account_id = table.Column<Guid>(type: "uuid", nullable: true),
status = table.Column<int>(type: "integer", nullable: false),
error_message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, 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_fediverse_activities", x => x.id);
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_actors_target_actor_id",
column: x => x.target_actor_id,
principalTable: "fediverse_actors",
principalColumn: "id");
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_contents_content_id",
column: x => x.content_id,
principalTable: "fediverse_contents",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_reactions",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
type = table.Column<int>(type: "integer", nullable: false),
emoji = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
is_local = table.Column<bool>(type: "boolean", nullable: false),
content_id = table.Column<Guid>(type: "uuid", nullable: false),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
local_account_id = table.Column<Guid>(type: "uuid", nullable: true),
local_reaction_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_fediverse_reactions", x => x.id);
table.ForeignKey(
name: "fk_fediverse_reactions_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_reactions_fediverse_contents_content_id",
column: x => x.content_id,
principalTable: "fediverse_contents",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_actor_id",
table: "fediverse_activities",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_content_id",
table: "fediverse_activities",
column: "content_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_target_actor_id",
table: "fediverse_activities",
column: "target_actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_actors_instance_id",
table: "fediverse_actors",
column: "instance_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_actors_uri",
table: "fediverse_actors",
column: "uri",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_actor_id",
table: "fediverse_contents",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_instance_id",
table: "fediverse_contents",
column: "instance_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_uri",
table: "fediverse_contents",
column: "uri",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_fediverse_instances_domain",
table: "fediverse_instances",
column: "domain",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_fediverse_reactions_actor_id",
table: "fediverse_reactions",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_reactions_content_id",
table: "fediverse_reactions",
column: "content_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_relationships_actor_id",
table: "fediverse_relationships",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_relationships_target_actor_id",
table: "fediverse_relationships",
column: "target_actor_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "fediverse_activities");
migrationBuilder.DropTable(
name: "fediverse_reactions");
migrationBuilder.DropTable(
name: "fediverse_relationships");
migrationBuilder.DropTable(
name: "fediverse_contents");
migrationBuilder.DropTable(
name: "fediverse_actors");
migrationBuilder.DropTable(
name: "fediverse_instances");
migrationBuilder.DropColumn(
name: "meta",
table: "publishers");
}
}
}

View File

@@ -22,7 +22,7 @@ namespace DysonNetwork.Sphere.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -140,7 +140,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("forwarded_message_id");
b.Property<List<Guid>>("MembersMentioned")
b.PrimitiveCollection<string>("MembersMentioned")
.HasColumnType("jsonb")
.HasColumnName("members_mentioned");
@@ -302,6 +302,592 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("chat_rooms", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActivity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<Guid?>("ContentId")
.HasColumnType("uuid")
.HasColumnName("content_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>("ErrorMessage")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("error_message");
b.Property<bool>("IsLocal")
.HasColumnType("boolean")
.HasColumnName("is_local");
b.Property<Guid?>("LocalAccountId")
.HasColumnType("uuid")
.HasColumnName("local_account_id");
b.Property<Guid?>("LocalPostId")
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<string>("ObjectUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("object_uri");
b.Property<Instant?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("published_at");
b.Property<Dictionary<string, object>>("RawData")
.HasColumnType("jsonb")
.HasColumnName("raw_data");
b.Property<int>("Status")
.HasColumnType("integer")
.HasColumnName("status");
b.Property<Guid?>("TargetActorId")
.HasColumnType("uuid")
.HasColumnName("target_actor_id");
b.Property<string>("TargetUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("target_uri");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_activities");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_activities_actor_id");
b.HasIndex("ContentId")
.HasDatabaseName("ix_fediverse_activities_content_id");
b.HasIndex("TargetActorId")
.HasDatabaseName("ix_fediverse_activities_target_actor_id");
b.ToTable("fediverse_activities", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<string>("AvatarUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("avatar_url");
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>("DisplayName")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("display_name");
b.Property<string>("FeaturedUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("featured_uri");
b.Property<string>("FollowersUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("followers_uri");
b.Property<string>("FollowingUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("following_uri");
b.Property<string>("HeaderUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("header_url");
b.Property<string>("InboxUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("inbox_uri");
b.Property<Guid>("InstanceId")
.HasColumnType("uuid")
.HasColumnName("instance_id");
b.Property<bool>("IsBot")
.HasColumnType("boolean")
.HasColumnName("is_bot");
b.Property<bool>("IsDiscoverable")
.HasColumnType("boolean")
.HasColumnName("is_discoverable");
b.Property<bool>("IsLocked")
.HasColumnType("boolean")
.HasColumnName("is_locked");
b.Property<Instant?>("LastActivityAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_activity_at");
b.Property<Instant?>("LastFetchedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_fetched_at");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
.HasColumnName("metadata");
b.Property<string>("OutboxUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("outbox_uri");
b.Property<string>("PublicKey")
.HasMaxLength(8192)
.HasColumnType("character varying(8192)")
.HasColumnName("public_key");
b.Property<string>("PublicKeyId")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("public_key_id");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_fediverse_actors");
b.HasIndex("InstanceId")
.HasDatabaseName("ix_fediverse_actors_instance_id");
b.HasIndex("Uri")
.IsUnique()
.HasDatabaseName("ix_fediverse_actors_uri");
b.ToTable("fediverse_actors", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<string>("AnnouncedContentUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
.HasColumnName("boost_count");
b.Property<string>("Content")
.HasColumnType("text")
.HasColumnName("content");
b.Property<string>("ContentHtml")
.HasColumnType("text")
.HasColumnName("content_html");
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?>("EditedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("in_reply_to");
b.Property<Guid>("InstanceId")
.HasColumnType("uuid")
.HasColumnName("instance_id");
b.Property<bool>("IsSensitive")
.HasColumnType("boolean")
.HasColumnName("is_sensitive");
b.Property<string>("Language")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("language");
b.Property<int>("LikeCount")
.HasColumnType("integer")
.HasColumnName("like_count");
b.Property<Guid?>("LocalPostId")
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
.HasColumnName("metadata");
b.Property<Instant?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("published_at");
b.Property<int>("ReplyCount")
.HasColumnType("integer")
.HasColumnName("reply_count");
b.Property<string>("Summary")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
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<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_contents");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_contents_actor_id");
b.HasIndex("InstanceId")
.HasDatabaseName("ix_fediverse_contents_instance_id");
b.HasIndex("Uri")
.IsUnique()
.HasDatabaseName("ix_fediverse_contents_uri");
b.ToTable("fediverse_contents", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseInstance", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<string>("BlockReason")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("block_reason");
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<string>("Domain")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("domain");
b.Property<bool>("IsBlocked")
.HasColumnType("boolean")
.HasColumnName("is_blocked");
b.Property<bool>("IsSilenced")
.HasColumnType("boolean")
.HasColumnName("is_silenced");
b.Property<Instant?>("LastActivityAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_activity_at");
b.Property<Instant?>("LastFetchedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_fetched_at");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
.HasColumnName("metadata");
b.Property<string>("Name")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasColumnName("name");
b.Property<string>("Software")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("software");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Version")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("version");
b.HasKey("Id")
.HasName("pk_fediverse_instances");
b.HasIndex("Domain")
.IsUnique()
.HasDatabaseName("ix_fediverse_instances_domain");
b.ToTable("fediverse_instances", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseReaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<Guid>("ContentId")
.HasColumnType("uuid")
.HasColumnName("content_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>("Emoji")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("emoji");
b.Property<bool>("IsLocal")
.HasColumnType("boolean")
.HasColumnName("is_local");
b.Property<Guid?>("LocalAccountId")
.HasColumnType("uuid")
.HasColumnName("local_account_id");
b.Property<Guid?>("LocalReactionId")
.HasColumnType("uuid")
.HasColumnName("local_reaction_id");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_reactions");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_reactions_actor_id");
b.HasIndex("ContentId")
.HasDatabaseName("ix_fediverse_reactions_content_id");
b.ToTable("fediverse_reactions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseRelationship", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_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?>("FollowedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("followed_at");
b.Property<Instant?>("FollowedBackAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("followed_back_at");
b.Property<bool>("IsBlocking")
.HasColumnType("boolean")
.HasColumnName("is_blocking");
b.Property<bool>("IsFollowedBy")
.HasColumnType("boolean")
.HasColumnName("is_followed_by");
b.Property<bool>("IsFollowing")
.HasColumnType("boolean")
.HasColumnName("is_following");
b.Property<bool>("IsLocalActor")
.HasColumnType("boolean")
.HasColumnName("is_local_actor");
b.Property<bool>("IsMuting")
.HasColumnType("boolean")
.HasColumnName("is_muting");
b.Property<Guid?>("LocalAccountId")
.HasColumnType("uuid")
.HasColumnName("local_account_id");
b.Property<Guid?>("LocalPublisherId")
.HasColumnType("uuid")
.HasColumnName("local_publisher_id");
b.Property<string>("RejectReason")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("reject_reason");
b.Property<int>("State")
.HasColumnType("integer")
.HasColumnName("state");
b.Property<Guid>("TargetActorId")
.HasColumnType("uuid")
.HasColumnName("target_actor_id");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_fediverse_relationships");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_relationships_actor_id");
b.HasIndex("TargetActorId")
.HasDatabaseName("ix_fediverse_relationships_target_actor_id");
b.ToTable("fediverse_relationships", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPoll", b =>
{
b.Property<Guid>("Id")
@@ -533,7 +1119,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("replied_post_id");
b.Property<List<ContentSensitiveMark>>("SensitiveMarks")
b.PrimitiveCollection<string>("SensitiveMarks")
.HasColumnType("jsonb")
.HasColumnName("sensitive_marks");
@@ -912,6 +1498,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<Dictionary<string, object>>("Meta")
.HasColumnType("jsonb")
.HasColumnName("meta");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
@@ -1572,6 +2162,108 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Sender");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActivity", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany("Activities")
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_activities_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseContent", "Content")
.WithMany("Activities")
.HasForeignKey("ContentId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_fediverse_activities_fediverse_contents_content_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "TargetActor")
.WithMany()
.HasForeignKey("TargetActorId")
.HasConstraintName("fk_fediverse_activities_fediverse_actors_target_actor_id");
b.Navigation("Actor");
b.Navigation("Content");
b.Navigation("TargetActor");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseInstance", "Instance")
.WithMany("Actors")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_actors_fediverse_instances_instance_id");
b.Navigation("Instance");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany("Contents")
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_contents_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseInstance", "Instance")
.WithMany("Contents")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_contents_fediverse_instances_instance_id");
b.Navigation("Actor");
b.Navigation("Instance");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseReaction", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany()
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_reactions_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseContent", "Content")
.WithMany("Reactions")
.HasForeignKey("ContentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_reactions_fediverse_contents_content_id");
b.Navigation("Actor");
b.Navigation("Content");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseRelationship", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany("FollowingRelationships")
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_relationships_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "TargetActor")
.WithMany("FollowerRelationships")
.HasForeignKey("TargetActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_relationships_fediverse_actors_target_actor_id");
b.Navigation("Actor");
b.Navigation("TargetActor");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPoll", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnPublisher", "Publisher")
@@ -1891,6 +2583,31 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Members");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.Navigation("Activities");
b.Navigation("Contents");
b.Navigation("FollowerRelationships");
b.Navigation("FollowingRelationships");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.Navigation("Activities");
b.Navigation("Reactions");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseInstance", b =>
{
b.Navigation("Actors");
b.Navigation("Contents");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPoll", b =>
{
b.Navigation("Questions");