Backend login and register

This commit is contained in:
2026-02-19 13:49:01 +01:00
parent 0b6bb019b6
commit 93a78e4614
62 changed files with 11588 additions and 13 deletions
+54
View File
@@ -0,0 +1,54 @@
using Application.Common.Results;
namespace Application.Errors;
public static class UserError
{
public static Error InternalServerError =>
new(ErrorTypeConstant.InternalServerError, "something went wrong");
public static Error UserNotFound =>
new(ErrorTypeConstant.NotFound, "User not found");
public static Error UserCookieConsentNotFound =>
new(ErrorTypeConstant.NotFound, "Cookie consent not found for user");
public static Error FailedToAssignRole =>
new(ErrorTypeConstant.InternalServerError, "failed to assign role");
public static Error FailedToRevokeRole =>
new(ErrorTypeConstant.InternalServerError, "failed to revoke role");
public static Error UserAlreadyHasRole =>
new(ErrorTypeConstant.ValidationError, "User already has role");
public static Error UserHasNoRole =>
new(ErrorTypeConstant.ValidationError, "User already has no role");
public static Error FailedToRevokeCookieConsent =>
new(ErrorTypeConstant.InternalServerError, "failed to revoke cookie consent");
public static Error UserAlreadyHasCookieConsent =>
new(ErrorTypeConstant.ValidationError, "User already has cookie consent");
public static Error UserHasNoCookieConsent =>
new(ErrorTypeConstant.ValidationError, "User already has no cookie consent");
public static Error CannotDeleteYourself =>
new(ErrorTypeConstant.ValidationError, "You cannot delete your own account");
public static Error CreateInvalidUserUpdateRequestError(IEnumerable<string> errors)
{
return new Error(ErrorTypeConstant.ValidationError, string.Join(", ", errors));
}
public static Error CreateInvalidCookieConsentError(IEnumerable<string> errors)
{
return new Error(ErrorTypeConstant.ValidationError, string.Join(", ", errors));
}
public static Error CreateInvalidLoginRequestError(IEnumerable<string> errors)
{
return new Error(ErrorTypeConstant.ValidationError, string.Join(", ", errors));
}
}