From ebac6698ff029e956e94e19ff915e39cbb3b4467 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 11 Jun 2025 23:35:04 +0800 Subject: [PATCH] :sparkles: Enrich user profile (skip ci) :boom: Un-migrated database changes, DO NOT PUSH TO PRODUCTION --- DysonNetwork.Sphere/Account/Account.cs | 2 ++ .../Account/AccountCurrentController.cs | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Sphere/Account/Account.cs b/DysonNetwork.Sphere/Account/Account.cs index eb93ea3..b681496 100644 --- a/DysonNetwork.Sphere/Account/Account.cs +++ b/DysonNetwork.Sphere/Account/Account.cs @@ -62,6 +62,8 @@ public class Profile : ModelBase [MaxLength(4096)] public string? Bio { get; set; } [MaxLength(1024)] public string? Gender { get; set; } [MaxLength(1024)] public string? Pronouns { get; set; } + [MaxLength(1024)] public string? TimeZone { get; set; } + [MaxLength(1024)] public string? Location { get; set; } public Instant? Birthday { get; set; } public Instant? LastSeenAt { get; set; } diff --git a/DysonNetwork.Sphere/Account/AccountCurrentController.cs b/DysonNetwork.Sphere/Account/AccountCurrentController.cs index 6e8c1b5..453b285 100644 --- a/DysonNetwork.Sphere/Account/AccountCurrentController.cs +++ b/DysonNetwork.Sphere/Account/AccountCurrentController.cs @@ -63,7 +63,12 @@ public class AccountCurrentController( [MaxLength(256)] public string? FirstName { get; set; } [MaxLength(256)] public string? MiddleName { get; set; } [MaxLength(256)] public string? LastName { get; set; } + [MaxLength(1024)] public string? Gender { get; set; } + [MaxLength(1024)] public string? Pronouns { get; set; } + [MaxLength(1024)] public string? TimeZone { get; set; } + [MaxLength(1024)] public string? Location { get; set; } [MaxLength(4096)] public string? Bio { get; set; } + public Instant? Birthday { get; set; } [MaxLength(32)] public string? PictureId { get; set; } [MaxLength(32)] public string? BackgroundId { get; set; } @@ -84,6 +89,11 @@ public class AccountCurrentController( if (request.MiddleName is not null) profile.MiddleName = request.MiddleName; if (request.LastName is not null) profile.LastName = request.LastName; if (request.Bio is not null) profile.Bio = request.Bio; + if (request.Gender is not null) profile.Gender = request.Gender; + if (request.Pronouns is not null) profile.Pronouns = request.Pronouns; + if (request.Birthday is not null) profile.Birthday = request.Birthday; + if (request.Location is not null) profile.Location = request.Location; + if (request.TimeZone is not null) profile.TimeZone = request.TimeZone; if (request.PictureId is not null) { @@ -667,7 +677,7 @@ public class AccountCurrentController( public async Task>> GetBadges() { if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - + var badges = await db.Badges .Where(b => b.AccountId == currentUser.Id) .ToListAsync();