feat(backend): limit total members per user

This commit is contained in:
sam 2024-09-30 21:44:41 +02:00
parent 80ac16694c
commit 4002893323
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 21 additions and 4 deletions

View file

@ -127,12 +127,14 @@ public static class ValidationUtils
return errors;
}
public const int MaxBioLength = 1024;
public static ValidationError? ValidateBio(string? bio)
{
return bio?.Length switch
{
0 => ValidationError.LengthError("Bio is too short", 1, 1024, bio.Length),
> 1024 => ValidationError.LengthError("Bio is too long", 1, 1024, bio.Length),
0 => ValidationError.LengthError("Bio is too short", 1, MaxBioLength, bio.Length),
> MaxBioLength => ValidationError.LengthError("Bio is too long", 1, MaxBioLength, bio.Length),
_ => null
};
}