Backend login and register
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user