feat(backend): add support conversations
This commit is contained in:
parent
a4ca0902a3
commit
ed3159c05d
12 changed files with 620 additions and 0 deletions
|
@ -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 =
|
||||
|
|
|
@ -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 =
|
||||
[
|
||||
"..",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue