Fix Join Event service_event
All checks were successful
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-02 19:30:40 +08:00
parent f5a7fa3551
commit 9c945d69a9
21 changed files with 1733 additions and 274 deletions

View File

@@ -16,11 +16,12 @@ import (
// @Tags Authentication // @Tags Authentication
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.ExchangeData true "Exchange Request Credentials" // @Param payload body service_auth.ExchangeData true "Exchange Request Credentials"
// @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResponse} "Successful exchange" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResponse} "Successful exchange"
// @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Router /auth/exchange [post] // @Router /auth/exchange [post]
func (self *AuthHandler) Exchange(c *gin.Context) { func (self *AuthHandler) Exchange(c *gin.Context) {
var exchangeData service_auth.ExchangeData var exchangeData service_auth.ExchangeData

View File

@@ -15,11 +15,12 @@ import (
// @Tags Authentication // @Tags Authentication
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.MagicData true "Magic Link Request Data" // @Param payload body service_auth.MagicData true "Magic Link Request Data"
// @Success 200 {object} utils.RespStatus{data=service_auth.MagicResponse} "Successful request" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Success 200 {object} utils.RespStatus{data=service_auth.MagicResponse} "Successful request"
// @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Router /auth/magic [post] // @Router /auth/magic [post]
func (self *AuthHandler) Magic(c *gin.Context) { func (self *AuthHandler) Magic(c *gin.Context) {
var magicData service_auth.MagicData var magicData service_auth.MagicData

View File

@@ -15,11 +15,12 @@ import (
// @Tags Authentication // @Tags Authentication
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.RefreshData true "Refresh Token Body" // @Param payload body service_auth.RefreshData true "Refresh Token Body"
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful rotation" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful rotation"
// @Failure 401 {object} utils.RespStatus{data=nil} "Invalid Refresh Token" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 401 {object} utils.RespStatus{data=nil} "Invalid Refresh Token"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Router /auth/refresh [post] // @Router /auth/refresh [post]
func (self *AuthHandler) Refresh(c *gin.Context) { func (self *AuthHandler) Refresh(c *gin.Context) {
var refreshData service_auth.RefreshData var refreshData service_auth.RefreshData

View File

@@ -15,11 +15,12 @@ import (
// @Tags Authentication // @Tags Authentication
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.TokenData true "Token Request Body" // @Param payload body service_auth.TokenData true "Token Request Body"
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful token issuance" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful token issuance"
// @Failure 403 {object} utils.RespStatus{data=nil} "Invalid or Expired Code" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 403 {object} utils.RespStatus{data=nil} "Invalid or Expired Code"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Router /auth/token [post] // @Router /auth/token [post]
func (self *AuthHandler) Token(c *gin.Context) { func (self *AuthHandler) Token(c *gin.Context) {
var tokenData service_auth.TokenData var tokenData service_auth.TokenData

View File

@@ -16,11 +16,12 @@ import (
// @Tags Event // @Tags Event
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param event_id query string true "Event UUID" // @Param event_id query string true "Event UUID"
// @Success 200 {object} utils.RespStatus{data=service_event.CheckinResponse} "Successfully generated code" // @Param X-Api-Version header string true "latest"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Success 200 {object} utils.RespStatus{data=service_event.CheckinResponse} "Successfully generated code"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /event/checkin [get] // @Router /event/checkin [get]
func (self *EventHandler) Checkin(c *gin.Context) { func (self *EventHandler) Checkin(c *gin.Context) {

View File

@@ -16,12 +16,13 @@ import (
// @Tags Event // @Tags Event
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param event_id query string true "Event UUID" // @Param event_id query string true "Event UUID"
// @Success 200 {object} utils.RespStatus{data=data.EventIndexDoc} "Successful retrieval" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Success 200 {object} utils.RespStatus{data=data.EventIndexDoc} "Successful retrieval"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /event/info [get] // @Router /event/info [get]
func (self *EventHandler) Info(c *gin.Context) { func (self *EventHandler) Info(c *gin.Context) {

View File

@@ -15,12 +15,13 @@ import (
// @Tags Event // @Tags Event
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param request body service_event.EventJoinData true "Event Join Details (UserId and EventId are required)" // @Param request body service_event.EventJoinData true "Event Join Details (UserId and EventId are required)"
// @Success 200 {object} utils.RespStatus{data=nil} "Successfully joined the event" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input or UUID Parse Failed" // @Success 200 {object} utils.RespStatus{data=nil} "Successfully joined the event"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input or UUID Parse Failed"
// @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized / Missing User ID" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / Database Error" // @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized / Missing User ID"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / Database Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /event/join [post] // @Router /event/join [post]
func (self *EventHandler) Join(c *gin.Context) { func (self *EventHandler) Join(c *gin.Context) {

View File

@@ -15,12 +15,13 @@ import (
// @Tags Event // @Tags Event
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param limit query string false "Maximum number of events to return (default 20)" // @Param limit query string false "Maximum number of events to return (default 20)"
// @Param offset query string true "Number of events to skip" // @Param offset query string true "Number of events to skip"
// @Success 200 {object} utils.RespStatus{data=[]data.EventIndexDoc} "Successful paginated list retrieval" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Missing offset or malformed parameters)" // @Success 200 {object} utils.RespStatus{data=[]data.EventIndexDoc} "Successful paginated list retrieval"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Missing offset or malformed parameters)"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database query failed)" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database query failed)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /event/list [get] // @Router /event/list [get]
func (self *EventHandler) List(c *gin.Context) { func (self *EventHandler) List(c *gin.Context) {

View File

@@ -13,11 +13,12 @@ import (
// @Tags KYC // @Tags KYC
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_kyc.KycQueryData true "KYC query data (KycId)" // @Param payload body service_kyc.KycQueryData true "KYC query data (KycId)"
// @Success 200 {object} utils.RespStatus{data=service_kyc.KycQueryResponse} "Query processed (success/pending/failed)" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid UUID or input" // @Success 200 {object} utils.RespStatus{data=service_kyc.KycQueryResponse} "Query processed (success/pending/failed)"
// @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid UUID or input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /kyc/query [post] // @Router /kyc/query [post]
func (self *KycHandler) Query(c *gin.Context) { func (self *KycHandler) Query(c *gin.Context) {

View File

@@ -13,11 +13,12 @@ import (
// @Tags KYC // @Tags KYC
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_kyc.KycSessionData true "KYC session data (Type and Base64 Identity)" // @Param payload body service_kyc.KycSessionData true "KYC session data (Type and Base64 Identity)"
// @Success 200 {object} utils.RespStatus{data=service_kyc.KycSessionResponse} "Session created successfully" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid input or decode failed" // @Success 200 {object} utils.RespStatus{data=service_kyc.KycSessionResponse} "Session created successfully"
// @Failure 403 {object} utils.RespStatus{data=nil} "Missing User ID" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid input or decode failed"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / KYC Service Error" // @Failure 403 {object} utils.RespStatus{data=nil} "Missing User ID"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / KYC Service Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /kyc/session [post] // @Router /kyc/session [post]
func (self *KycHandler) Session(c *gin.Context) { func (self *KycHandler) Session(c *gin.Context) {

View File

@@ -16,10 +16,11 @@ import (
// @Tags User // @Tags User
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval" // @Param X-Api-Version header string true "latest"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
// @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)" // @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /user/info [get] // @Router /user/info [get]
func (self *UserHandler) Info(c *gin.Context) { func (self *UserHandler) Info(c *gin.Context) {

View File

@@ -15,12 +15,13 @@ import (
// @Tags User // @Tags User
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param limit query string false "Maximum number of users to return (default 0)" // @Param limit query string false "Maximum number of users to return (default 0)"
// @Param offset query string true "Number of users to skip" // @Param offset query string true "Number of users to skip"
// @Success 200 {object} utils.RespStatus{data=[]data.UserIndexDoc} "Successful paginated list retrieval" // @Param X-Api-Version header string true "latest"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Success 200 {object} utils.RespStatus{data=[]data.UserIndexDoc} "Successful paginated list retrieval"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Format Error)" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Search Engine or Missing Offset)" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Format Error)"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Search Engine or Missing Offset)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /user/list [get] // @Router /user/list [get]
func (self *UserHandler) List(c *gin.Context) { func (self *UserHandler) List(c *gin.Context) {

View File

@@ -16,12 +16,13 @@ import (
// @Tags User // @Tags User
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param user_id path string true "Other user id" // @Param user_id path string true "Other user id"
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval" // @Param X-Api-Version header string true "latest"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
// @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 403 {object} utils.RespStatus{data=nil} "User Not Public" // @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)" // @Failure 403 {object} utils.RespStatus{data=nil} "User Not Public"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /user/info/{user_id} [get] // @Router /user/info/{user_id} [get]
func (self *UserHandler) Other(c *gin.Context) { func (self *UserHandler) Other(c *gin.Context) {

View File

@@ -17,11 +17,12 @@ import (
// @Tags User // @Tags User
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_user.UserInfoData true "Updated User Profile Data" // @Param payload body service_user.UserInfoData true "Updated User Profile Data"
// @Success 200 {object} utils.RespStatus{data=nil} "Successful profile update" // @Param X-Api-Version header string true "latest"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Validation Failed)" // @Success 200 {object} utils.RespStatus{data=nil} "Successful profile update"
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Validation Failed)"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database Error / UUID Parse Failed)" // @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database Error / UUID Parse Failed)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /user/update [patch] // @Router /user/update [patch]
func (self *UserHandler) Update(c *gin.Context) { func (self *UserHandler) Update(c *gin.Context) {

View File

@@ -10,7 +10,7 @@ import (
type Kyc struct { type Kyc struct {
Id uint `json:"id" gorm:"primarykey;autoincrement"` Id uint `json:"id" gorm:"primarykey;autoincrement"`
UUID uuid.UUID `json:"uuid" gorm:"type:uuid;uniqueindex;not null"` UUID uuid.UUID `json:"uuid" gorm:"type:uuid;uniqueindex;not null"`
UserId uuid.UUID `json:"user_id" gorm:"type:uuid;not null"` // 已移除 uniqueindex UserId uuid.UUID `json:"user_id" gorm:"type:uuid;not null"`
KycId uuid.UUID `json:"kyc_id" gorm:"type:uuid;uniqueindex;not null"` KycId uuid.UUID `json:"kyc_id" gorm:"type:uuid;uniqueindex;not null"`
Type string `json:"type" gorm:"type:varchar(255);not null"` Type string `json:"type" gorm:"type:varchar(255);not null"`
KycInfo string `json:"kyc_info" gorm:"type:text"` // aes256(base64) KycInfo string `json:"kyc_info" gorm:"type:text"` // aes256(base64)

View File

@@ -46,6 +46,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_auth.ExchangeData" "$ref": "#/definitions/service_auth.ExchangeData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -146,6 +153,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_auth.MagicData" "$ref": "#/definitions/service_auth.MagicData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -353,6 +367,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_auth.RefreshData" "$ref": "#/definitions/service_auth.RefreshData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -453,6 +474,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_auth.TokenData" "$ref": "#/definitions/service_auth.TokenData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -556,6 +584,13 @@ const docTemplate = `{
"name": "event_id", "name": "event_id",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -813,6 +848,13 @@ const docTemplate = `{
"name": "event_id", "name": "event_id",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -936,6 +978,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_event.EventJoinData" "$ref": "#/definitions/service_event.EventJoinData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1063,6 +1112,13 @@ const docTemplate = `{
"name": "offset", "name": "offset",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1171,6 +1227,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_kyc.KycQueryData" "$ref": "#/definitions/service_kyc.KycQueryData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1276,6 +1339,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_kyc.KycSessionData" "$ref": "#/definitions/service_kyc.KycSessionData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1372,6 +1442,15 @@ const docTemplate = `{
"User" "User"
], ],
"summary": "Get My User Information", "summary": "Get My User Information",
"parameters": [
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Successful profile retrieval", "description": "Successful profile retrieval",
@@ -1473,6 +1552,13 @@ const docTemplate = `{
"name": "user_id", "name": "user_id",
"in": "path", "in": "path",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1600,6 +1686,13 @@ const docTemplate = `{
"name": "offset", "name": "offset",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1708,6 +1801,13 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/service_user.UserInfoData" "$ref": "#/definitions/service_user.UserInfoData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {

View File

@@ -44,6 +44,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_auth.ExchangeData" "$ref": "#/definitions/service_auth.ExchangeData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -144,6 +151,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_auth.MagicData" "$ref": "#/definitions/service_auth.MagicData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -351,6 +365,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_auth.RefreshData" "$ref": "#/definitions/service_auth.RefreshData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -451,6 +472,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_auth.TokenData" "$ref": "#/definitions/service_auth.TokenData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -554,6 +582,13 @@
"name": "event_id", "name": "event_id",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -811,6 +846,13 @@
"name": "event_id", "name": "event_id",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -934,6 +976,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_event.EventJoinData" "$ref": "#/definitions/service_event.EventJoinData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1061,6 +1110,13 @@
"name": "offset", "name": "offset",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1169,6 +1225,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_kyc.KycQueryData" "$ref": "#/definitions/service_kyc.KycQueryData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1274,6 +1337,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_kyc.KycSessionData" "$ref": "#/definitions/service_kyc.KycSessionData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1370,6 +1440,15 @@
"User" "User"
], ],
"summary": "Get My User Information", "summary": "Get My User Information",
"parameters": [
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Successful profile retrieval", "description": "Successful profile retrieval",
@@ -1471,6 +1550,13 @@
"name": "user_id", "name": "user_id",
"in": "path", "in": "path",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1598,6 +1684,13 @@
"name": "offset", "name": "offset",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {
@@ -1706,6 +1799,13 @@
"schema": { "schema": {
"$ref": "#/definitions/service_user.UserInfoData" "$ref": "#/definitions/service_user.UserInfoData"
} }
},
{
"type": "string",
"description": "latest",
"name": "X-Api-Version",
"in": "header",
"required": true
} }
], ],
"responses": { "responses": {

View File

@@ -195,6 +195,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_auth.ExchangeData' $ref: '#/definitions/service_auth.ExchangeData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -250,6 +255,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_auth.MagicData' $ref: '#/definitions/service_auth.MagicData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -370,6 +380,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_auth.RefreshData' $ref: '#/definitions/service_auth.RefreshData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -425,6 +440,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_auth.TokenData' $ref: '#/definitions/service_auth.TokenData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -479,6 +499,11 @@ paths:
name: event_id name: event_id
required: true required: true
type: string type: string
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -620,6 +645,11 @@ paths:
name: event_id name: event_id
required: true required: true
type: string type: string
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -686,6 +716,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_event.EventJoinData' $ref: '#/definitions/service_event.EventJoinData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -755,6 +790,11 @@ paths:
name: offset name: offset
required: true required: true
type: string type: string
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -814,6 +854,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_kyc.KycQueryData' $ref: '#/definitions/service_kyc.KycQueryData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -871,6 +916,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_kyc.KycSessionData' $ref: '#/definitions/service_kyc.KycSessionData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -921,6 +971,12 @@ paths:
- application/json - application/json
description: Fetches the complete profile data for the user associated with description: Fetches the complete profile data for the user associated with
the provided session/token. the provided session/token.
parameters:
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -977,6 +1033,11 @@ paths:
name: user_id name: user_id
required: true required: true
type: string type: string
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -1046,6 +1107,11 @@ paths:
name: offset name: offset
required: true required: true
type: string type: string
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@@ -1106,6 +1172,11 @@ paths:
required: true required: true
schema: schema:
$ref: '#/definitions/service_user.UserInfoData' $ref: '#/definitions/service_user.UserInfoData'
- description: latest
in: header
name: X-Api-Version
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:

68
go.mod
View File

@@ -2,18 +2,24 @@ module nixcn-cms
go 1.25.5 go 1.25.5
replace (
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1
)
require ( require (
github.com/alibabacloud-go/cloudauth-20190307/v4 v4.12.1 github.com/alibabacloud-go/cloudauth-20190307/v4 v4.13.1
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13 github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.14
github.com/alibabacloud-go/tea v1.3.13 github.com/alibabacloud-go/tea v1.4.0
github.com/alibabacloud-go/tea-utils/v2 v2.0.7 github.com/alibabacloud-go/tea-utils/v2 v2.0.9
github.com/aliyun/credentials-go v1.4.5 github.com/aliyun/credentials-go v1.4.11
github.com/gin-gonic/gin v1.11.0 github.com/gin-gonic/gin v1.11.0
github.com/goccy/go-json v0.10.5 github.com/goccy/go-json v0.10.5
github.com/golang-jwt/jwt/v5 v5.3.0 github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/redis/go-redis/extra/redisotel/v9 v9.17.2 github.com/redis/go-redis/extra/redisotel/v9 v9.17.3
github.com/redis/go-redis/v9 v9.17.2 github.com/redis/go-redis/v9 v9.17.3
github.com/spf13/viper v1.21.0 github.com/spf13/viper v1.21.0
github.com/swaggo/files v1.0.1 github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.1 github.com/swaggo/gin-swagger v1.6.1
@@ -44,41 +50,36 @@ require (
github.com/ClickHouse/ch-go v0.61.5 // indirect github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.30.0 // indirect github.com/ClickHouse/clickhouse-go/v2 v2.30.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
github.com/alibabacloud-go/debug v1.0.1 // indirect github.com/alibabacloud-go/debug v1.0.1 // indirect
github.com/alibabacloud-go/openapi-util v0.1.1 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect github.com/andybalholm/brotli v1.1.1 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.15.0 // indirect github.com/bytedance/sonic v1.14.2 // indirect
github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/clbanning/mxj/v2 v2.7.0 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.12 // indirect github.com/gabriel-vasile/mimetype v1.4.11 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect github.com/go-faster/errors v0.7.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.21.4 // indirect github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.22.3 // indirect github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag/conv v0.25.4 // indirect github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
github.com/go-openapi/swag/loading v0.25.4 // indirect
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.30.1 // indirect github.com/go-playground/validator/v10 v10.28.0 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect github.com/goccy/go-yaml v1.19.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -87,10 +88,12 @@ require (
github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.8 // indirect github.com/klauspost/compress v1.17.8 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -99,8 +102,8 @@ require (
github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/quic-go/qpack v0.6.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect github.com/quic-go/quic-go v0.57.1 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.17.2 // indirect github.com/redis/go-redis/extra/rediscmd/v9 v9.17.3 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect
@@ -118,17 +121,18 @@ require (
go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/arch v0.23.0 // indirect golang.org/x/arch v0.23.0 // indirect
golang.org/x/mod v0.32.0 // indirect golang.org/x/mod v0.31.0 // indirect
golang.org/x/net v0.49.0 // indirect golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.40.0 // indirect golang.org/x/sys v0.40.0 // indirect
golang.org/x/tools v0.41.0 // indirect golang.org/x/tools v0.40.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.77.0 // indirect google.golang.org/grpc v1.77.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/driver/clickhouse v0.7.0 // indirect gorm.io/driver/clickhouse v0.7.0 // indirect
gorm.io/driver/mysql v1.5.7 // indirect gorm.io/driver/mysql v1.5.7 // indirect
) )

1371
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -2,12 +2,13 @@ package service_event
import ( import (
"context" "context"
"errors"
"nixcn-cms/data" "nixcn-cms/data"
"nixcn-cms/internal/exception" "nixcn-cms/internal/exception"
"nixcn-cms/service/shared" "nixcn-cms/service/shared"
"time"
"github.com/google/uuid" "github.com/google/uuid"
"gorm.io/gorm"
) )
type EventJoinData struct { type EventJoinData struct {
@@ -116,90 +117,38 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
return return
} }
if eventData.EnableKYC == true && payload.Data.KycId != "" { attendenceSearch, err := new(data.Attendance).GetAttendanceByEventIdAndUserId(payload.Context, eventId, userId)
kycId, err := uuid.Parse(payload.Data.KycId)
if err != nil {
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorUuidParseFailed).
SetError(err).
Throw(payload.Context)
result = &EventJoinResult{ if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
Common: shared.CommonResult{ return &EventJoinResult{
HttpCode: 400,
Exception: exception,
},
}
return
}
kycData, err := new(data.Kyc).GetByKycId(payload.Context, &kycId)
if err != nil {
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorDatabase).
SetError(err).
Throw(payload.Context)
result = &EventJoinResult{
Common: shared.CommonResult{
HttpCode: 500,
Exception: exception,
},
}
return
}
if kycData.UserId != userId {
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
SetError(err).
Throw(payload.Context)
result = &EventJoinResult{
Common: shared.CommonResult{
HttpCode: 400,
Exception: exception,
},
}
return
}
attendenceData.SetKycId(kycData.KycId)
}
if !eventData.EndTime.Before(time.Now()) {
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeSpecific).
SetOriginal(exception.EventJoinEventInvalid).
SetError(err).
Throw(payload.Context)
result = &EventJoinResult{
Common: shared.CommonResult{ Common: shared.CommonResult{
HttpCode: 403, HttpCode: 500,
Exception: exception, Exception: new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorDatabase).
SetError(err).
Throw(payload.Context),
}, },
} }
}
return if err == nil && attendenceSearch != nil && attendenceSearch.AttendanceId != uuid.Nil {
return &EventJoinResult{
Common: shared.CommonResult{
HttpCode: 403,
Exception: new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeSpecific).
SetOriginal(exception.EventJoinEventInvalid).
SetError(errors.New("user already joined this event")).
Throw(payload.Context),
},
}
} }
attendenceData.SetUserId(userId) attendenceData.SetUserId(userId)
@@ -209,23 +158,19 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
err = attendenceData.Create(payload.Context) err = attendenceData.Create(payload.Context)
if err != nil { if err != nil {
exception := new(exception.Builder). return &EventJoinResult{
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorDatabase).
SetError(err).
Throw(payload.Context)
result = &EventJoinResult{
Common: shared.CommonResult{ Common: shared.CommonResult{
HttpCode: 500, HttpCode: 500,
Exception: exception, Exception: new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceJoin).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorDatabase).
SetError(err).
Throw(payload.Context),
}, },
} }
return
} }
exception := new(exception.Builder). exception := new(exception.Builder).