Include account info for personal publishers

This commit is contained in:
LittleSheep 2025-05-27 22:49:33 +08:00
parent fcaeb9afbe
commit acece9cbce
5 changed files with 3430 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class LimitedSizeForPictureIdOnPub : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -1775,6 +1775,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnName("account_id");
b.Property<string>("BackgroundId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("background_id");
@ -1804,6 +1805,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnName("nick");
b.Property<string>("PictureId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("picture_id");

View File

@ -22,9 +22,9 @@ public class Publisher : ModelBase
[MaxLength(256)] public string Nick { get; set; } = string.Empty;
[MaxLength(4096)] public string? Bio { get; set; }
public string? PictureId { get; set; }
[MaxLength(32)] public string? PictureId { get; set; }
public CloudFile? Picture { get; set; }
public string? BackgroundId { get; set; }
[MaxLength(32)] public string? BackgroundId { get; set; }
public CloudFile? Background { get; set; }
[JsonIgnore] public ICollection<Post.Post> Posts { get; set; } = new List<Post.Post>();
@ -35,7 +35,7 @@ public class Publisher : ModelBase
public ICollection<PublisherSubscription> Subscriptions { get; set; } = new List<PublisherSubscription>();
public Guid? AccountId { get; set; }
[JsonIgnore] public Account.Account? Account { get; set; }
public Account.Account? Account { get; set; }
public Guid? RealmId { get; set; }
[JsonIgnore] public Realm.Realm? Realm { get; set; }
}

View File

@ -20,6 +20,7 @@ public class PublisherController(AppDatabase db, PublisherService ps, FileServic
public async Task<ActionResult<Publisher>> GetPublisher(string name)
{
var publisher = await db.Publishers
.Include(e => e.Account)
.Where(e => e.Name == name)
.FirstOrDefaultAsync();
if (publisher is null) return NotFound();