♻️ Better delivery service for AP

This commit is contained in:
2026-01-01 01:20:44 +08:00
parent c59fc011f4
commit 14d5254461
13 changed files with 3091 additions and 139 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddActivityPubDelivery : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "activity_pub_deliveries",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
activity_id = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
activity_type = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
inbox_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
actor_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
status = table.Column<int>(type: "integer", nullable: false),
retry_count = table.Column<int>(type: "integer", nullable: false),
error_message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
last_attempt_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
next_retry_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
sent_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
response_status_code = table.Column<string>(type: "character varying(2048)", maxLength: 2048, 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_activity_pub_deliveries", x => x.id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "activity_pub_deliveries");
}
}
}

View File

@@ -27,6 +27,85 @@ namespace DysonNetwork.Sphere.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DysonNetwork.Shared.Models.SnActivityPubDelivery", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<string>("ActivityId")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("activity_id");
b.Property<string>("ActivityType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasColumnName("activity_type");
b.Property<string>("ActorUri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("actor_uri");
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<string>("InboxUri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("inbox_uri");
b.Property<Instant?>("LastAttemptAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_attempt_at");
b.Property<Instant?>("NextRetryAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("next_retry_at");
b.Property<string>("ResponseStatusCode")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("response_status_code");
b.Property<int>("RetryCount")
.HasColumnType("integer")
.HasColumnName("retry_count");
b.Property<Instant?>("SentAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("sent_at");
b.Property<int>("Status")
.HasColumnType("integer")
.HasColumnName("status");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_activity_pub_deliveries");
b.ToTable("activity_pub_deliveries", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMember", b =>
{
b.Property<Guid>("Id")