Fix swagger data struct error
Some checks failed
Backend Check Build (NixCN CMS) TeamCity build failed
Client CMS Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-29 01:25:12 +08:00
parent f7bde8ef2e
commit 654b196bfd
15 changed files with 136 additions and 316 deletions

View File

@@ -23,11 +23,13 @@ type ExchangePayload struct {
Data *ExchangeData
}
type ExchangeResponse struct {
RedirectUri string `json:"redirect_uri"`
}
type ExchangeResult struct {
Common shared.CommonResult
Data *struct {
RedirectUri string `json:"redirect_uri"`
}
Data *ExchangeResponse
}
func (self *AuthServiceImpl) Exchange(payload *ExchangePayload) (result *ExchangeResult) {
@@ -113,16 +115,14 @@ func (self *AuthServiceImpl) Exchange(payload *ExchangePayload) (result *Exchang
SetError(nil).
Throw(payload.Context)
resultData := struct {
RedirectUri string `json:"redirect_uri"`
}{url.String()}
resultData := &ExchangeResponse{url.String()}
result = &ExchangeResult{
Common: shared.CommonResult{
HttpCode: 200,
Exception: exception,
},
Data: &resultData,
Data: resultData,
}
return

View File

@@ -26,9 +26,13 @@ type MagicPayload struct {
Data *MagicData
}
type MagicResponse struct {
Uri string `json:"uri"`
}
type MagicResult struct {
Common shared.CommonResult
Data any
Data *MagicResponse
}
func (self *AuthServiceImpl) Magic(payload *MagicPayload) (result *MagicResult) {
@@ -129,7 +133,7 @@ func (self *AuthServiceImpl) Magic(payload *MagicPayload) (result *MagicResult)
HttpCode: 200,
Exception: exception,
},
Data: uriData,
Data: &MagicResponse{uriData.Uri},
}
return

View File

@@ -20,11 +20,13 @@ type CheckinPayload struct {
Data *CheckinData
}
type CheckinResponse struct {
CheckinCode *string `json:"checkin_code"`
}
type CheckinResult struct {
Common shared.CommonResult
Data *struct {
CheckinCode *string `json:"checkin_code"`
}
Data *CheckinResponse
}
func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) {
@@ -44,6 +46,7 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR
Throw(payload.Context),
},
}
return
}
@@ -58,10 +61,9 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR
SetOriginal(exception.CommonSuccess).
Throw(payload.Context),
},
Data: &struct {
CheckinCode *string `json:"checkin_code"`
}{code},
Data: &CheckinResponse{code},
}
return
}
@@ -123,11 +125,13 @@ type CheckinQueryPayload struct {
Data *CheckinQueryData
}
type CheckinQueryResponse struct {
CheckinAt *time.Time `json:"checkin_at"`
}
type CheckinQueryResult struct {
Common shared.CommonResult
Data *struct {
CheckinAt *time.Time `json:"checkin_at"`
}
Data *CheckinQueryResponse
}
func (self *EventServiceImpl) CheckinQuery(payload *CheckinQueryPayload) (result *CheckinQueryResult) {
@@ -183,9 +187,7 @@ func (self *EventServiceImpl) CheckinQuery(payload *CheckinQueryPayload) (result
SetOriginal(exception.CommonSuccess).
Throw(payload.Context),
},
Data: &struct {
CheckinAt *time.Time `json:"checkin_at"`
}{checkinAt},
Data: &CheckinQueryResponse{checkinAt},
}
return
}

View File

@@ -19,13 +19,15 @@ type InfoPayload struct {
Data *InfoData
}
type InfoResponse struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
type InfoResult struct {
Common shared.CommonResult
Data *struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
Data *InfoResponse
}
func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
@@ -50,16 +52,6 @@ func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
return
}
resultData := struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}{
Name: event.Name,
StartTime: event.StartTime,
EndTime: event.EndTime,
}
result = &InfoResult{
Common: shared.CommonResult{
HttpCode: 200,
@@ -71,7 +63,11 @@ func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
SetOriginal(exception.CommonSuccess).
Throw(payload.Context),
},
Data: &resultData,
Data: &InfoResponse{
Name: event.Name,
StartTime: event.StartTime,
EndTime: event.EndTime,
},
}
return

View File

@@ -11,9 +11,13 @@ type UserTablePayload struct {
Context context.Context
}
type UserTableResponse struct {
UserTable *[]data.User `json:"user_table"`
}
type UserTableResult struct {
Common shared.CommonResult
Data *[]data.User `json:"user_table"`
Data *UserTableResponse
}
// ListUserFullTable
@@ -58,7 +62,7 @@ func (self *UserServiceImpl) GetUserFullTable(payload *UserTablePayload) (result
HttpCode: 200,
Exception: exception,
},
Data: userFullTable,
Data: &UserTableResponse{userFullTable},
}
return