🐛 Bug fixes

This commit is contained in:
LittleSheep 2025-04-15 01:07:42 +08:00
parent fa42ea67ac
commit c901781323
2 changed files with 6 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;