moved to struct validation;
This commit is contained in:
@@ -2,6 +2,28 @@ package errors
|
||||
|
||||
import "errors"
|
||||
|
||||
type ValidationKeys struct {
|
||||
Invalid string
|
||||
InternalServerError string
|
||||
InvalidJson string
|
||||
Unauthorized string
|
||||
InvalidSubscriptionModel string
|
||||
UserNotFoundWrongPassword string
|
||||
JwtGenerationFailed string
|
||||
Duplicate string
|
||||
InvalidUserID string
|
||||
}
|
||||
|
||||
type ValidationFields struct {
|
||||
General string
|
||||
ParentMemberShipID string
|
||||
SubscriptionModel string
|
||||
UserID string
|
||||
Login string
|
||||
Email string
|
||||
User string
|
||||
}
|
||||
|
||||
var (
|
||||
ErrNotFound = errors.New("not found")
|
||||
ErrUserNotFound = errors.New("user not found")
|
||||
@@ -18,4 +40,31 @@ var (
|
||||
ErrValidToken = errors.New("valid token")
|
||||
ErrInvalidUserData = errors.New("invalid user data")
|
||||
ErrDuplicateEntry = errors.New("duplicate entry; unique constraint failed")
|
||||
ErrNotAuthorized = errors.New("not authorized")
|
||||
ValErrParentIDNotSet = errors.New("Parent Membership ID not provided")
|
||||
ValErrParentIDNotFound = errors.New("Parent Membership ID not found")
|
||||
)
|
||||
|
||||
var Responses = struct {
|
||||
Keys ValidationKeys
|
||||
Fields ValidationFields
|
||||
}{
|
||||
Keys: ValidationKeys{
|
||||
Invalid: "server.validation.invalid",
|
||||
InternalServerError: "server.error.internal_server_error",
|
||||
InvalidJson: "server.error.invalid_json",
|
||||
Unauthorized: "server.error.unauthorized",
|
||||
UserNotFoundWrongPassword: "server.validation.user_not_found_or_wrong_password",
|
||||
JwtGenerationFailed: "server.error.jwt_generation_failed",
|
||||
Duplicate: "server.validation.duplicate",
|
||||
},
|
||||
Fields: ValidationFields{
|
||||
General: "general",
|
||||
ParentMemberShipID: "parent_membership_id",
|
||||
SubscriptionModel: "subscription_model",
|
||||
UserID: "user_id",
|
||||
Login: "login",
|
||||
Email: "email",
|
||||
User: "user",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user