feat: complete API-driven projects with infrastructure and business acceptance
This commit is contained in:
18
examples/userService/internal/service/user/listUsers.go
Normal file
18
examples/userService/internal/service/user/listUsers.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"example.com/userService/internal/types"
|
||||
)
|
||||
|
||||
func (s *Service) ListUsers(ctx context.Context, req *types.ListUsersReq) (*types.UserPageResp, error) {
|
||||
page, err := s.deps.Users.List(ctx, req.Page, req.PageSize)
|
||||
if err != nil {
|
||||
return nil, s.failure(ctx, err)
|
||||
}
|
||||
result := &types.UserPageResp{Items: []types.UserResp{}, Total: page.Total, Page: page.Page, PageSize: page.PageSize}
|
||||
for _, item := range page.Items {
|
||||
result.Items = append(result.Items, *response(item))
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user