@@ -16,11 +16,12 @@ import (
|
||||
// @Tags Authentication
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_auth.ExchangeData true "Exchange Request Credentials"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResponse} "Successful exchange"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param payload body service_auth.ExchangeData true "Exchange Request Credentials"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResponse} "Successful exchange"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Router /auth/exchange [post]
|
||||
func (self *AuthHandler) Exchange(c *gin.Context) {
|
||||
var exchangeData service_auth.ExchangeData
|
||||
|
||||
@@ -15,11 +15,12 @@ import (
|
||||
// @Tags Authentication
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_auth.MagicData true "Magic Link Request Data"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.MagicResponse} "Successful request"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param payload body service_auth.MagicData true "Magic Link Request Data"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.MagicResponse} "Successful request"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Router /auth/magic [post]
|
||||
func (self *AuthHandler) Magic(c *gin.Context) {
|
||||
var magicData service_auth.MagicData
|
||||
|
||||
@@ -15,11 +15,12 @@ import (
|
||||
// @Tags Authentication
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_auth.RefreshData true "Refresh Token Body"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful rotation"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Invalid Refresh Token"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param payload body service_auth.RefreshData true "Refresh Token Body"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful rotation"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Invalid Refresh Token"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Router /auth/refresh [post]
|
||||
func (self *AuthHandler) Refresh(c *gin.Context) {
|
||||
var refreshData service_auth.RefreshData
|
||||
|
||||
@@ -15,11 +15,12 @@ import (
|
||||
// @Tags Authentication
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_auth.TokenData true "Token Request Body"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful token issuance"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Invalid or Expired Code"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param payload body service_auth.TokenData true "Token Request Body"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_auth.TokenResponse} "Successful token issuance"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @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]
|
||||
func (self *AuthHandler) Token(c *gin.Context) {
|
||||
var tokenData service_auth.TokenData
|
||||
|
||||
@@ -16,11 +16,12 @@ import (
|
||||
// @Tags Event
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param event_id query string true "Event UUID"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_event.CheckinResponse} "Successfully generated code"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param event_id query string true "Event UUID"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_event.CheckinResponse} "Successfully generated code"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /event/checkin [get]
|
||||
func (self *EventHandler) Checkin(c *gin.Context) {
|
||||
|
||||
@@ -16,12 +16,13 @@ import (
|
||||
// @Tags Event
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param event_id query string true "Event UUID"
|
||||
// @Success 200 {object} utils.RespStatus{data=data.EventIndexDoc} "Successful retrieval"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param event_id query string true "Event UUID"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=data.EventIndexDoc} "Successful retrieval"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /event/info [get]
|
||||
func (self *EventHandler) Info(c *gin.Context) {
|
||||
|
||||
@@ -15,12 +15,13 @@ import (
|
||||
// @Tags Event
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @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"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input or UUID Parse Failed"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized / Missing User ID"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / Database Error"
|
||||
// @Param request body service_event.EventJoinData true "Event Join Details (UserId and EventId are required)"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=nil} "Successfully joined the event"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input or UUID Parse Failed"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @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
|
||||
// @Router /event/join [post]
|
||||
func (self *EventHandler) Join(c *gin.Context) {
|
||||
|
||||
@@ -15,12 +15,13 @@ import (
|
||||
// @Tags Event
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param limit query string false "Maximum number of events to return (default 20)"
|
||||
// @Param offset query string true "Number of events to skip"
|
||||
// @Success 200 {object} utils.RespStatus{data=[]data.EventIndexDoc} "Successful paginated list retrieval"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Missing offset or malformed parameters)"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database query failed)"
|
||||
// @Param limit query string false "Maximum number of events to return (default 20)"
|
||||
// @Param offset query string true "Number of events to skip"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=[]data.EventIndexDoc} "Successful paginated list retrieval"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Missing offset or malformed parameters)"
|
||||
// @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
|
||||
// @Router /event/list [get]
|
||||
func (self *EventHandler) List(c *gin.Context) {
|
||||
|
||||
@@ -13,11 +13,12 @@ import (
|
||||
// @Tags KYC
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @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)"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid UUID or input"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Param payload body service_kyc.KycQueryData true "KYC query data (KycId)"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_kyc.KycQueryResponse} "Query processed (success/pending/failed)"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid UUID or input"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Unauthorized"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /kyc/query [post]
|
||||
func (self *KycHandler) Query(c *gin.Context) {
|
||||
|
||||
@@ -13,11 +13,12 @@ import (
|
||||
// @Tags KYC
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @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"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid input or decode failed"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "Missing User ID"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error / KYC Service Error"
|
||||
// @Param payload body service_kyc.KycSessionData true "KYC session data (Type and Base64 Identity)"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_kyc.KycSessionResponse} "Session created successfully"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid input or decode failed"
|
||||
// @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
|
||||
// @Router /kyc/session [post]
|
||||
func (self *KycHandler) Session(c *gin.Context) {
|
||||
|
||||
@@ -16,10 +16,11 @@ import (
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @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
|
||||
// @Router /user/info [get]
|
||||
func (self *UserHandler) Info(c *gin.Context) {
|
||||
|
||||
@@ -15,12 +15,13 @@ import (
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param limit query string false "Maximum number of users to return (default 0)"
|
||||
// @Param offset query string true "Number of users to skip"
|
||||
// @Success 200 {object} utils.RespStatus{data=[]data.UserIndexDoc} "Successful paginated list retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @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)"
|
||||
// @Param limit query string false "Maximum number of users to return (default 0)"
|
||||
// @Param offset query string true "Number of users to skip"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=[]data.UserIndexDoc} "Successful paginated list retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @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
|
||||
// @Router /user/list [get]
|
||||
func (self *UserHandler) List(c *gin.Context) {
|
||||
|
||||
@@ -16,12 +16,13 @@ import (
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param user_id path string true "Other user id"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found"
|
||||
// @Failure 403 {object} utils.RespStatus{data=nil} "User Not Public"
|
||||
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)"
|
||||
// @Param user_id path string true "Other user id"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval"
|
||||
// @Failure 401 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found"
|
||||
// @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
|
||||
// @Router /user/info/{user_id} [get]
|
||||
func (self *UserHandler) Other(c *gin.Context) {
|
||||
|
||||
@@ -17,11 +17,12 @@ import (
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_user.UserInfoData true "Updated User Profile Data"
|
||||
// @Success 200 {object} utils.RespStatus{data=nil} "Successful profile update"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Validation 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)"
|
||||
// @Param payload body service_user.UserInfoData true "Updated User Profile Data"
|
||||
// @Param X-Api-Version header string true "latest"
|
||||
// @Success 200 {object} utils.RespStatus{data=nil} "Successful profile update"
|
||||
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input (Validation 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
|
||||
// @Router /user/update [patch]
|
||||
func (self *UserHandler) Update(c *gin.Context) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
type Kyc struct {
|
||||
Id uint `json:"id" gorm:"primarykey;autoincrement"`
|
||||
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"`
|
||||
Type string `json:"type" gorm:"type:varchar(255);not null"`
|
||||
KycInfo string `json:"kyc_info" gorm:"type:text"` // aes256(base64)
|
||||
|
||||
100
docs/docs.go
100
docs/docs.go
@@ -46,6 +46,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.ExchangeData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -146,6 +153,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.MagicData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -353,6 +367,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.RefreshData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -453,6 +474,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.TokenData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -556,6 +584,13 @@ const docTemplate = `{
|
||||
"name": "event_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -813,6 +848,13 @@ const docTemplate = `{
|
||||
"name": "event_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -936,6 +978,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_event.EventJoinData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1063,6 +1112,13 @@ const docTemplate = `{
|
||||
"name": "offset",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1171,6 +1227,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_kyc.KycQueryData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1276,6 +1339,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_kyc.KycSessionData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1372,6 +1442,15 @@ const docTemplate = `{
|
||||
"User"
|
||||
],
|
||||
"summary": "Get My User Information",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful profile retrieval",
|
||||
@@ -1473,6 +1552,13 @@ const docTemplate = `{
|
||||
"name": "user_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1600,6 +1686,13 @@ const docTemplate = `{
|
||||
"name": "offset",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1708,6 +1801,13 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_user.UserInfoData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
@@ -44,6 +44,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.ExchangeData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -144,6 +151,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.MagicData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -351,6 +365,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.RefreshData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -451,6 +472,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_auth.TokenData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -554,6 +582,13 @@
|
||||
"name": "event_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -811,6 +846,13 @@
|
||||
"name": "event_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -934,6 +976,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_event.EventJoinData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1061,6 +1110,13 @@
|
||||
"name": "offset",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1169,6 +1225,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_kyc.KycQueryData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1274,6 +1337,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_kyc.KycSessionData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1370,6 +1440,15 @@
|
||||
"User"
|
||||
],
|
||||
"summary": "Get My User Information",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful profile retrieval",
|
||||
@@ -1471,6 +1550,13 @@
|
||||
"name": "user_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1598,6 +1684,13 @@
|
||||
"name": "offset",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1706,6 +1799,13 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service_user.UserInfoData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "latest",
|
||||
"name": "X-Api-Version",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
@@ -195,6 +195,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_auth.ExchangeData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -250,6 +255,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_auth.MagicData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -370,6 +380,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_auth.RefreshData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -425,6 +440,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_auth.TokenData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -479,6 +499,11 @@ paths:
|
||||
name: event_id
|
||||
required: true
|
||||
type: string
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -620,6 +645,11 @@ paths:
|
||||
name: event_id
|
||||
required: true
|
||||
type: string
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -686,6 +716,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_event.EventJoinData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -755,6 +790,11 @@ paths:
|
||||
name: offset
|
||||
required: true
|
||||
type: string
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -814,6 +854,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_kyc.KycQueryData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -871,6 +916,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_kyc.KycSessionData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -921,6 +971,12 @@ paths:
|
||||
- application/json
|
||||
description: Fetches the complete profile data for the user associated with
|
||||
the provided session/token.
|
||||
parameters:
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -977,6 +1033,11 @@ paths:
|
||||
name: user_id
|
||||
required: true
|
||||
type: string
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -1046,6 +1107,11 @@ paths:
|
||||
name: offset
|
||||
required: true
|
||||
type: string
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -1106,6 +1172,11 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/service_user.UserInfoData'
|
||||
- description: latest
|
||||
in: header
|
||||
name: X-Api-Version
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
||||
68
go.mod
68
go.mod
@@ -2,18 +2,24 @@ module nixcn-cms
|
||||
|
||||
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 (
|
||||
github.com/alibabacloud-go/cloudauth-20190307/v4 v4.12.1
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13
|
||||
github.com/alibabacloud-go/tea v1.3.13
|
||||
github.com/alibabacloud-go/tea-utils/v2 v2.0.7
|
||||
github.com/aliyun/credentials-go v1.4.5
|
||||
github.com/alibabacloud-go/cloudauth-20190307/v4 v4.13.1
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.14
|
||||
github.com/alibabacloud-go/tea v1.4.0
|
||||
github.com/alibabacloud-go/tea-utils/v2 v2.0.9
|
||||
github.com/aliyun/credentials-go v1.4.11
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
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/redis/go-redis/extra/redisotel/v9 v9.17.2
|
||||
github.com/redis/go-redis/v9 v9.17.2
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.17.3
|
||||
github.com/redis/go-redis/v9 v9.17.3
|
||||
github.com/spf13/viper v1.21.0
|
||||
github.com/swaggo/files v1.0.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/clickhouse-go/v2 v2.30.0 // 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/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/bytedance/gopkg v0.1.3 // indirect
|
||||
github.com/bytedance/sonic v1.15.0 // indirect
|
||||
github.com/bytedance/sonic/loader v0.5.0 // indirect
|
||||
github.com/bytedance/sonic v1.14.2 // indirect
|
||||
github.com/bytedance/sonic/loader v0.4.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // 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/go-faster/city v1.0.1 // indirect
|
||||
github.com/go-faster/errors v0.7.1 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.4 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.4 // indirect
|
||||
github.com/go-openapi/spec v0.22.3 // indirect
|
||||
github.com/go-openapi/swag/conv v0.25.4 // 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-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-openapi/spec v0.20.4 // indirect
|
||||
github.com/go-openapi/swag v0.19.15 // indirect
|
||||
github.com/go-playground/locales v0.14.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-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/hashicorp/go-version v1.6.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/jinzhu/inflection v1.0.0 // 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/klauspost/compress v1.17.8 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.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/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // 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/pkg/errors v0.9.1 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/quic-go/quic-go v0.59.0 // indirect
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.17.2 // indirect
|
||||
github.com/quic-go/quic-go v0.57.1 // indirect
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.17.3 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
github.com/segmentio/asm v1.2.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.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/arch v0.23.0 // indirect
|
||||
golang.org/x/mod v0.32.0 // indirect
|
||||
golang.org/x/net v0.49.0 // indirect
|
||||
golang.org/x/mod v0.31.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/tools v0.41.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect
|
||||
golang.org/x/tools v0.40.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // 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/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/mysql v1.5.7 // indirect
|
||||
)
|
||||
|
||||
@@ -2,12 +2,13 @@ package service_event
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"nixcn-cms/data"
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/service/shared"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type EventJoinData struct {
|
||||
@@ -116,90 +117,38 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
return
|
||||
}
|
||||
|
||||
if eventData.EnableKYC == true && payload.Data.KycId != "" {
|
||||
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)
|
||||
attendenceSearch, err := new(data.Attendance).GetAttendanceByEventIdAndUserId(payload.Context, eventId, userId)
|
||||
|
||||
result = &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
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{
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 403,
|
||||
Exception: exception,
|
||||
HttpCode: 500,
|
||||
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)
|
||||
@@ -209,23 +158,19 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
|
||||
err = attendenceData.Create(payload.Context)
|
||||
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{
|
||||
return &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
HttpCode: 500,
|
||||
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).
|
||||
|
||||
Reference in New Issue
Block a user