diff --git a/internal/handler/user_handler.go b/internal/handler/user_handler.go index 4dc977a..18165a6 100644 --- a/internal/handler/user_handler.go +++ b/internal/handler/user_handler.go @@ -148,6 +148,9 @@ func (h *UserHandler) GetUser(c *gin.Context) { } func (h *UserHandler) ListUsers(c *gin.Context) { + ctx := c.Request.Context() + contextInfo := appcontext.FromGinContext(ctx) + req := &contract.ListUsersRequest{ Page: 1, Limit: 10, @@ -188,6 +191,7 @@ func (h *UserHandler) ListUsers(c *gin.Context) { return } + req.OrganizationID = &contextInfo.OrganizationID usersResponse, err := h.userService.ListUsers(c.Request.Context(), req) if err != nil { logger.FromContext(c).WithError(err).Error("UserHandler::ListUsers -> Failed to list users from service") diff --git a/internal/models/order.go b/internal/models/order.go index beb8648..5aabcac 100644 --- a/internal/models/order.go +++ b/internal/models/order.go @@ -142,7 +142,6 @@ type RefundOrderItemRequest struct { Reason *string `validate:"omitempty,max=255"` } -// Response DTOs type OrderResponse struct { ID uuid.UUID OrganizationID uuid.UUID diff --git a/internal/service/user_service.go b/internal/service/user_service.go index 252c5cd..fbbfeca 100644 --- a/internal/service/user_service.go +++ b/internal/service/user_service.go @@ -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) { page, limit := transformer.PaginationToRequest(req.Page, req.Limit) - organizationID := uuid.New() - userResponses, totalCount, err := s.userProcessor.ListUsers(ctx, organizationID, page, limit) + userResponses, totalCount, err := s.userProcessor.ListUsers(ctx, *req.OrganizationID, page, limit) if err != nil { return nil, err }