add users
This commit is contained in:
parent
fe4f17b34d
commit
c18e915d1e
@ -148,6 +148,9 @@ func (h *UserHandler) GetUser(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *UserHandler) ListUsers(c *gin.Context) {
|
func (h *UserHandler) ListUsers(c *gin.Context) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
contextInfo := appcontext.FromGinContext(ctx)
|
||||||
|
|
||||||
req := &contract.ListUsersRequest{
|
req := &contract.ListUsersRequest{
|
||||||
Page: 1,
|
Page: 1,
|
||||||
Limit: 10,
|
Limit: 10,
|
||||||
@ -188,6 +191,7 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req.OrganizationID = &contextInfo.OrganizationID
|
||||||
usersResponse, err := h.userService.ListUsers(c.Request.Context(), req)
|
usersResponse, err := h.userService.ListUsers(c.Request.Context(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.FromContext(c).WithError(err).Error("UserHandler::ListUsers -> Failed to list users from service")
|
logger.FromContext(c).WithError(err).Error("UserHandler::ListUsers -> Failed to list users from service")
|
||||||
|
|||||||
@ -142,7 +142,6 @@ type RefundOrderItemRequest struct {
|
|||||||
Reason *string `validate:"omitempty,max=255"`
|
Reason *string `validate:"omitempty,max=255"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response DTOs
|
|
||||||
type OrderResponse struct {
|
type OrderResponse struct {
|
||||||
ID uuid.UUID
|
ID uuid.UUID
|
||||||
OrganizationID uuid.UUID
|
OrganizationID uuid.UUID
|
||||||
|
|||||||
@ -73,8 +73,7 @@ func (s *UserServiceImpl) GetUserByEmail(ctx context.Context, email string) (*co
|
|||||||
func (s *UserServiceImpl) ListUsers(ctx context.Context, req *contract.ListUsersRequest) (*contract.ListUsersResponse, error) {
|
func (s *UserServiceImpl) ListUsers(ctx context.Context, req *contract.ListUsersRequest) (*contract.ListUsersResponse, error) {
|
||||||
page, limit := transformer.PaginationToRequest(req.Page, req.Limit)
|
page, limit := transformer.PaginationToRequest(req.Page, req.Limit)
|
||||||
|
|
||||||
organizationID := uuid.New()
|
userResponses, totalCount, err := s.userProcessor.ListUsers(ctx, *req.OrganizationID, page, limit)
|
||||||
userResponses, totalCount, err := s.userProcessor.ListUsers(ctx, organizationID, page, limit)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user