First merge from develop to main (WIP) #7

Merged
sugar merged 199 commits from develop into main 2026-01-27 17:47:07 +00:00
2 changed files with 27 additions and 14 deletions
Showing only changes of commit 5a5239e335 - Show all commits

View File

@@ -9,15 +9,30 @@ import (
)
func (self *UserHandler) List(c *gin.Context) {
limit, limitStatus := c.GetQuery("limit")
offset, offsetStatus := c.GetQuery("offset")
type ListQuery struct {
Limit *string `form:"limit"`
Offset *string `form:"offset"`
}
var query ListQuery
if err := c.ShouldBindQuery(&query); err != nil {
exception := new(exception.Builder).
SetStatus(exception.StatusClient).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
Throw(c).
String()
utils.HttpResponse(c, 400, exception)
return
}
userListPayload := &service.UserListPayload{
Context: c,
Limit: &limit,
LimitStatus: &limitStatus,
Offset: &offset,
OffsetStatus: &offsetStatus,
Limit: query.Limit,
Offset: query.Offset,
}
result := self.svc.ListUsers(userListPayload)

View File

@@ -281,9 +281,7 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
type UserListPayload struct {
Context context.Context
Limit *string
LimitStatus *bool
Offset *string
OffsetStatus *bool
}
type UserListResult struct {
@@ -294,12 +292,12 @@ type UserListResult struct {
// ListUsers
func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserListResult) {
var limit string
if !*payload.LimitStatus || *payload.Limit == "" {
if payload.Limit == nil || *payload.Limit == "" {
limit = "0"
}
var offset string
if !*payload.OffsetStatus || *payload.Offset == "" {
if payload.Offset == nil || *payload.Offset == "" {
exception := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).