diff --git a/DysonNetwork.Sphere/Account/AccountController.cs b/DysonNetwork.Sphere/Account/AccountController.cs index 9b8f281..38626d8 100644 --- a/DysonNetwork.Sphere/Account/AccountController.cs +++ b/DysonNetwork.Sphere/Account/AccountController.cs @@ -82,6 +82,8 @@ public class AccountController(AppDatabase db) : ControllerBase var account = await db.Accounts .Include(e => e.Profile) + .Include(e => e.Profile.Picture) + .Include(e => e.Profile.Background) .Where(e => e.Id == userId) .FirstOrDefaultAsync(); @@ -155,6 +157,7 @@ public class AccountController(AppDatabase db) : ControllerBase picture.UsedCount++; profile.Picture = picture; + db.Update(picture); } if (request.BackgroundId is not null) @@ -169,8 +172,10 @@ public class AccountController(AppDatabase db) : ControllerBase background.UsedCount++; profile.Background = background; + db.Update(background); } + db.Update(profile); await db.SaveChangesAsync(); return profile; } diff --git a/DysonNetwork.Sphere/Storage/CloudFile.cs b/DysonNetwork.Sphere/Storage/CloudFile.cs index 93aa63f..43a6187 100644 --- a/DysonNetwork.Sphere/Storage/CloudFile.cs +++ b/DysonNetwork.Sphere/Storage/CloudFile.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using Newtonsoft.Json; +using System.Text.Json.Serialization; using NodaTime; namespace DysonNetwork.Sphere.Storage;