From bf6dbfdca0da5a6427f8df759b724bb0db8a8e95 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 27 May 2025 22:55:56 +0800 Subject: [PATCH] :recycle: Change the way to load publisher account --- DysonNetwork.Sphere/Publisher/PublisherController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Sphere/Publisher/PublisherController.cs b/DysonNetwork.Sphere/Publisher/PublisherController.cs index 531c190..d837686 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherController.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherController.cs @@ -20,10 +20,16 @@ public class PublisherController(AppDatabase db, PublisherService ps, FileServic public async Task> GetPublisher(string name) { var publisher = await db.Publishers - .Include(e => e.Account) .Where(e => e.Name == name) .FirstOrDefaultAsync(); if (publisher is null) return NotFound(); + if (publisher.AccountId is null) return Ok(publisher); + + var account = await db.Accounts + .Where(a => a.Id == publisher.AccountId) + .Include(a => a.Profile) + .FirstOrDefaultAsync(); + publisher.Account = account; return Ok(publisher); }