First merge from develop to main (WIP) #7
@@ -25,3 +25,10 @@ auth:
|
||||
user:
|
||||
list:
|
||||
meilisearch_failed: "00001"
|
||||
event:
|
||||
info:
|
||||
not_found: "00001"
|
||||
checkin:
|
||||
gen_code_failed: "00001"
|
||||
checkin_query:
|
||||
record_not_found: "00001"
|
||||
|
||||
@@ -20,7 +20,7 @@ func JWTAuth() gin.HandlerFunc {
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.MiddlewareServiceJwt).
|
||||
SetEndpoint(exception.EndpointMiddlewareService).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUnauthorized).
|
||||
Build()
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ func Magic(c *gin.Context) {
|
||||
var req MagicRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthMagicEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -39,10 +39,10 @@ func Magic(c *gin.Context) {
|
||||
ok, err := turnstile.VerifyTurnstile(req.TurnstileToken, c.ClientIP())
|
||||
if err != nil || !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthMagicEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicTurnstileFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -52,10 +52,10 @@ func Magic(c *gin.Context) {
|
||||
code, err := authcode.NewAuthCode(req.ClientId, req.Email)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthMagicEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicCodeGenFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -66,10 +66,10 @@ func Magic(c *gin.Context) {
|
||||
url, err := url.Parse(externalUrl)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthMagicEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicInvalidExternalUrl).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -96,10 +96,10 @@ func Magic(c *gin.Context) {
|
||||
emailClient, err := new(email.Client).NewSMTPClient()
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthMagicEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicInvalidEmailConfig).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
|
||||
@@ -16,10 +16,10 @@ func Redirect(c *gin.Context) {
|
||||
clientId := c.Query("client_id")
|
||||
if clientId == "" {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -29,10 +29,10 @@ func Redirect(c *gin.Context) {
|
||||
redirectUri := c.Query("redirect_uri")
|
||||
if redirectUri == "" {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -42,10 +42,10 @@ func Redirect(c *gin.Context) {
|
||||
state := c.Query("state")
|
||||
if state == "" {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -58,10 +58,10 @@ func Redirect(c *gin.Context) {
|
||||
authCode, ok := authcode.VerifyAuthCode(code)
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectTokenInvalid).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -82,10 +82,10 @@ func Redirect(c *gin.Context) {
|
||||
user.PermissionLevel = 10
|
||||
if err := user.Create(); err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -93,10 +93,10 @@ func Redirect(c *gin.Context) {
|
||||
}
|
||||
} else {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -108,10 +108,10 @@ func Redirect(c *gin.Context) {
|
||||
client, err := clientData.GetClientByClientId(clientId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectClientNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -121,10 +121,10 @@ func Redirect(c *gin.Context) {
|
||||
err = client.ValidateRedirectURI(redirectUri)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectUriMismatch).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -134,10 +134,10 @@ func Redirect(c *gin.Context) {
|
||||
newCode, err := authcode.NewAuthCode(clientId, authCode.Email)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -147,10 +147,10 @@ func Redirect(c *gin.Context) {
|
||||
url, err := url.Parse(redirectUri)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRedirectEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectInvalidUri).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
|
||||
@@ -16,10 +16,10 @@ func Refresh(c *gin.Context) {
|
||||
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRefreshEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRefresh).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -33,10 +33,10 @@ func Refresh(c *gin.Context) {
|
||||
accessToken, err := JwtTool.RefreshAccessToken(req.RefreshToken)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRefreshEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRefresh).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRefreshInvalidToken).
|
||||
Build()
|
||||
utils.HttpResponse(c, 401, errorCode)
|
||||
@@ -46,10 +46,10 @@ func Refresh(c *gin.Context) {
|
||||
refreshToken, err := JwtTool.RenewRefreshToken(req.RefreshToken)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthRefreshEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceRefresh).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRefreshRenewFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
|
||||
@@ -21,10 +21,10 @@ func Token(c *gin.Context) {
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthTokenEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -34,10 +34,10 @@ func Token(c *gin.Context) {
|
||||
authCode, ok := authcode.VerifyAuthCode(req.Code)
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthTokenEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthTokenInvalidToken).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -48,10 +48,10 @@ func Token(c *gin.Context) {
|
||||
user, err := userData.GetByEmail(authCode.Email)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthTokenEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -65,10 +65,10 @@ func Token(c *gin.Context) {
|
||||
accessToken, refreshToken, err := JwtTool.IssueTokens(authCode.ClientId, user.UserId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthTokenEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthTokenGenFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
|
||||
@@ -15,10 +15,10 @@ func Checkin(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -27,10 +27,10 @@ func Checkin(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -40,10 +40,10 @@ func Checkin(c *gin.Context) {
|
||||
eventIdOrig, ok := c.GetQuery("event_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -54,10 +54,10 @@ func Checkin(c *gin.Context) {
|
||||
eventId, err := uuid.Parse(eventIdOrig)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -67,10 +67,10 @@ func Checkin(c *gin.Context) {
|
||||
code, err := data.GenCheckinCode(eventId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.EventCheckinGenCodeFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -93,10 +93,10 @@ func CheckinSubmit(c *gin.Context) {
|
||||
err := attendanceData.VerifyCheckinCode(req.ChekinCode)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinSubmitEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinSubmit).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -110,10 +110,10 @@ func CheckinQuery(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -122,10 +122,10 @@ func CheckinQuery(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -135,10 +135,10 @@ func CheckinQuery(c *gin.Context) {
|
||||
eventIdOrig, ok := c.GetQuery("event_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -147,10 +147,10 @@ func CheckinQuery(c *gin.Context) {
|
||||
eventId, err := uuid.Parse(eventIdOrig)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -162,20 +162,20 @@ func CheckinQuery(c *gin.Context) {
|
||||
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
} else if attendance == nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventCheckinQueryEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.EventCheckinQueryRecordNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 404, errorCode)
|
||||
|
||||
@@ -15,10 +15,10 @@ func Info(c *gin.Context) {
|
||||
eventIdOrig, ok := c.GetQuery("event_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventInfoEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -29,10 +29,10 @@ func Info(c *gin.Context) {
|
||||
eventId, err := uuid.Parse(eventIdOrig)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventInfoEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -42,10 +42,10 @@ func Info(c *gin.Context) {
|
||||
event, err := eventData.GetEventById(eventId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.EventService).
|
||||
SetEndpoint(exception.EventInfoEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceInfo).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.EventInfoNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 404, errorCode)
|
||||
|
||||
@@ -13,10 +13,10 @@ func Full(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserFullEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -25,10 +25,10 @@ func Full(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserFullEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -38,10 +38,10 @@ func Full(c *gin.Context) {
|
||||
userData, err := new(data.User).GetByUserId(userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserFullEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 404, errorCode)
|
||||
@@ -51,10 +51,10 @@ func Full(c *gin.Context) {
|
||||
users, err := userData.GetFullTable()
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserFullEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
|
||||
@@ -14,10 +14,10 @@ func Info(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserInfoEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -26,10 +26,10 @@ func Info(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserInfoEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -40,10 +40,10 @@ func Info(c *gin.Context) {
|
||||
user, err := userData.GetByUserId(userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserInfoEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 404, errorCode)
|
||||
|
||||
@@ -18,10 +18,10 @@ func List(c *gin.Context) {
|
||||
offset, ok := c.GetQuery("offset")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserListEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -32,10 +32,10 @@ func List(c *gin.Context) {
|
||||
limitNum, err := strconv.ParseInt(limit, 10, 64)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserListEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -44,10 +44,10 @@ func List(c *gin.Context) {
|
||||
offsetNum, err := strconv.ParseInt(offset, 10, 64)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserListEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -58,10 +58,10 @@ func List(c *gin.Context) {
|
||||
list, err := new(data.User).FastListUsers(limitNum, offsetNum)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserListEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.UserListMeilisearchFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
|
||||
@@ -17,10 +17,10 @@ func Update(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
@@ -29,10 +29,10 @@ func Update(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -43,10 +43,10 @@ func Update(c *gin.Context) {
|
||||
err = c.ShouldBindJSON(&ReqInfo)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -57,10 +57,10 @@ func Update(c *gin.Context) {
|
||||
userData, err := new(data.User).GetByUserId(userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusUser).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -79,10 +79,10 @@ func Update(c *gin.Context) {
|
||||
if ReqInfo.Username != "" {
|
||||
if len(ReqInfo.Username) < 5 || len(ReqInfo.Username) >= 255 {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -94,10 +94,10 @@ func Update(c *gin.Context) {
|
||||
if ReqInfo.Nickname != "" {
|
||||
if utf8.RuneCountInString(ReqInfo.Nickname) > 24 {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -109,10 +109,10 @@ func Update(c *gin.Context) {
|
||||
if ReqInfo.Subtitle != "" {
|
||||
if utf8.RuneCountInString(ReqInfo.Subtitle) > 32 {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -125,10 +125,10 @@ func Update(c *gin.Context) {
|
||||
_, err := url.ParseRequestURI(ReqInfo.Avatar)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -140,10 +140,10 @@ func Update(c *gin.Context) {
|
||||
if ReqInfo.Bio != "" {
|
||||
if !cryptography.IsBase64Std(ReqInfo.Bio) {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.UserService).
|
||||
SetEndpoint(exception.UserUpdateEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
|
||||
Reference in New Issue
Block a user