feat(backend): ability to set profile flags, return profile flags in get user endpoint

This commit is contained in:
sam 2024-09-27 14:48:09 +02:00
parent 6a4aa8064a
commit a3cbdc1a08
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
4 changed files with 62 additions and 15 deletions

View file

@ -86,6 +86,12 @@ public class UsersController(
user.Fields = req.Fields.ToList();
}
if (req.Flags != null)
{
var flagError = await db.SetUserFlagsAsync(CurrentUser!.Id, req.Flags);
if (flagError != null) errors.Add(("flags", flagError));
}
if (req.HasProperty(nameof(req.Avatar)))
errors.Add(("avatar", ValidationUtils.ValidateAvatar(req.Avatar)));
@ -182,6 +188,7 @@ public class UsersController(
public FieldEntry[]? Names { get; init; }
public Pronoun[]? Pronouns { get; init; }
public Field[]? Fields { get; init; }
public Snowflake[]? Flags { get; init; }
}