First merge from develop to main (WIP) #7

Merged
sugar merged 199 commits from develop into main 2026-01-27 17:47:07 +00:00
11 changed files with 81 additions and 10 deletions
Showing only changes of commit 9aff7d8f26 - Show all commits

View File

@@ -1,4 +1,5 @@
common:
success: "00000"
error:
invalid_input: "00001"
unauthorized: "00002"

View File

@@ -113,5 +113,12 @@ func Exchange(c *gin.Context) {
RedirectUri string `json:"redirect_uri"`
}{url.String()}
utils.HttpResponse(c, 200, "", "success", exchangeResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusSuccess).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, exchangeResp)
}

View File

@@ -118,5 +118,12 @@ func Magic(c *gin.Context) {
)
}
utils.HttpResponse(c, 200, "", "magic link sent")
errorCode := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceMagic).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode)
}

View File

@@ -64,5 +64,12 @@ func Refresh(c *gin.Context) {
RefreshToken string `json:"refresh_token"`
}{accessToken, refreshToken}
utils.HttpResponse(c, 200, "", "success", tokenResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, tokenResp)
}

View File

@@ -83,5 +83,12 @@ func Token(c *gin.Context) {
RefreshToken string `json:"refresh_token"`
}{accessToken, refreshToken}
utils.HttpResponse(c, 200, "", "success", tokenResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, tokenResp)
}

View File

@@ -196,5 +196,12 @@ func CheckinQuery(c *gin.Context) {
CheckinAt time.Time `json:"checkin_at"`
}{attendance.CheckinAt}
utils.HttpResponse(c, 200, "", "success", checkInAtResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, checkInAtResp)
}

View File

@@ -60,5 +60,12 @@ func Info(c *gin.Context) {
EndTime time.Time `json:"end_time"`
}{event.Name, event.StartTime, event.EndTime}
utils.HttpResponse(c, 200, "", "success", eventInfoResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceInfo).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, eventInfoResp)
}

View File

@@ -67,5 +67,12 @@ func Full(c *gin.Context) {
userFullResp := struct {
UserTable *[]data.User `json:"user_table"`
}{users}
utils.HttpResponse(c, 200, "", "success", userFullResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceFull).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, userFullResp)
}

View File

@@ -63,5 +63,12 @@ func Info(c *gin.Context) {
PermissionLevel uint `json:"permission_level"`
}{user.UserId, user.Email, user.Username, user.Nickname, user.Subtitle, user.Avatar, user.Bio, user.PermissionLevel}
utils.HttpResponse(c, 200, "", "success", userInfoResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceInfo).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, userInfoResp)
}

View File

@@ -73,5 +73,12 @@ func List(c *gin.Context) {
userListResp := struct {
List *[]data.UserSearchDoc `json:"list"`
}{list}
utils.HttpResponse(c, 200, "", "success", userListResp)
errorCode := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode, userListResp)
}

View File

@@ -159,5 +159,12 @@ func Update(c *gin.Context) {
// Update user info
userData.UpdateByUserID(userId)
utils.HttpResponse(c, 200, "", "success")
errorCode := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
utils.HttpResponse(c, 200, errorCode)
}