Skip to main content

List company users with pagination

GET 

/company/users/

Returns a paginated list of all users belonging to the authenticated user's company, excluding users with the 'dev' role.

Objective

Allow administrators and managers to view the complete list of users in their company with search and pagination options.

Use Cases

  • List users for administrative management
  • Search users by name, email, or last name
  • Paginate large user lists

Authentication

  • Requires a valid JWT (m.isLoged middleware)
  • User must be authenticated
  • Only returns users from the authenticated user's company

Filtering & Pagination

  • search: Searches by name, email, or last name (case-insensitive search)
  • page: Page number (default: 1)
  • limit: Results per page (default: ITEMS_PAGE from environment)
  • Automatically excludes users with the 'dev' role

Notes

  • Returns pagination using mongoose-paginate-v2
  • Results use model.parse() for transformation

Request

Responses

User list retrieved successfully.