feat(frontend): add username editing

This commit is contained in:
sam 2024-10-01 16:06:02 +02:00
parent 5a8b7aae80
commit 2a66e3e25e
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
10 changed files with 164 additions and 23 deletions

View file

@ -177,14 +177,16 @@ public class UsersController(
public bool Favourite { get; set; }
}
public const int MaxCustomPreferences = 25;
private static List<(string, ValidationError?)> ValidateCustomPreferences(
List<CustomPreferencesUpdateRequest> preferences)
{
var errors = new List<(string, ValidationError?)>();
if (preferences.Count > 25)
if (preferences.Count > MaxCustomPreferences)
errors.Add(("custom_preferences",
ValidationError.LengthError("Too many custom preferences", 0, 25, preferences.Count)));
ValidationError.LengthError("Too many custom preferences", 0, MaxCustomPreferences, preferences.Count)));
if (preferences.Count > 50) return errors;
// TODO: validate individual preferences