Files
cms-server/service/service_user/list_user_full_table.go
Asai Neko 654b196bfd
Some checks failed
Backend Check Build (NixCN CMS) TeamCity build failed
Client CMS Check Build (NixCN CMS) TeamCity build finished
Fix swagger data struct error
Signed-off-by: Asai Neko <sugar@sne.moe>
2026-01-29 01:25:12 +08:00

70 lines
1.4 KiB
Go

package service_user
import (
"context"
"nixcn-cms/data"
"nixcn-cms/internal/exception"
"nixcn-cms/service/shared"
)
type UserTablePayload struct {
Context context.Context
}
type UserTableResponse struct {
UserTable *[]data.User `json:"user_table"`
}
type UserTableResult struct {
Common shared.CommonResult
Data *UserTableResponse
}
// ListUserFullTable
func (self *UserServiceImpl) GetUserFullTable(payload *UserTablePayload) (result *UserTableResult) {
var err error
userFullTable, err := new(data.User).
GetFullTable(payload.Context)
if err != nil {
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceFull).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorDatabase).
SetError(err).
Throw(payload.Context)
result = &UserTableResult{
Common: shared.CommonResult{
HttpCode: 500,
Exception: exception,
},
Data: nil,
}
return
}
exception := new(exception.Builder).
SetStatus(exception.StatusServer).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceFull).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
SetError(nil).
Throw(payload.Context)
result = &UserTableResult{
Common: shared.CommonResult{
HttpCode: 200,
Exception: exception,
},
Data: &UserTableResponse{userFullTable},
}
return
}