feat(backend): add support conversations

This commit is contained in:
sam 2024-10-03 19:27:26 +02:00
parent a4ca0902a3
commit ed3159c05d
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
12 changed files with 620 additions and 0 deletions

View file

@ -7,6 +7,7 @@ public static class AuthUtils
{
public const string ClientCredentials = "client_credentials";
public const string AuthorizationCode = "authorization_code";
private static readonly string[] ForbiddenSchemes =
[
"javascript",
@ -21,6 +22,7 @@ public static class AuthUtils
"user.read_hidden",
"user.read_privileged",
"user.update",
"user.support",
];
public static readonly string[] MemberScopes =

View file

@ -9,6 +9,25 @@ namespace Foxnouns.Backend.Utils;
/// </summary>
public static partial class ValidationUtils
{
public static void ValidateStringLength(
this string s,
string fieldName,
int minLength,
int maxLength
)
{
if (s.Length < minLength)
throw new ApiError.BadRequest(
fieldName,
ValidationError.LengthError("Field is too short", minLength, maxLength, s.Length)
);
if (s.Length > maxLength)
throw new ApiError.BadRequest(
fieldName,
ValidationError.LengthError("Field is too long", minLength, maxLength, s.Length)
);
}
private static readonly string[] InvalidUsernames =
[
"..",