Skip to content

Admin: Get All Users (Paginated)#76

Merged
ayshadogo merged 1 commit into
Dfunder:mainfrom
sadeeq6400:getAllUsers
Jun 20, 2026
Merged

Admin: Get All Users (Paginated)#76
ayshadogo merged 1 commit into
Dfunder:mainfrom
sadeeq6400:getAllUsers

Conversation

@sadeeq6400

Copy link
Copy Markdown
Contributor

Builder
Thought process
Implementing User List Logic

I've reviewed the admin.users.controller.js file and am now focused on modifying the listUsers function. My next step involves implementing the requested features within this function.

Processing Query Parameters

I am now extracting query parameters like page, limit, and search from req.query, establishing defaults where necessary. Next, I'll build a filter object for MongoDB based on these parameters.

I will now update the listUsers function in c:\Users\a-abdulkareem\Documents\NAERA\G-FOX\api-fox\src\controllers\admin.users.controller.js to implement pagination and filtering. I will replace the existing listUsers function with a new version that includes the required logic.

admin.users.controller.js
src\controllers\admin.users.controller.js
+41
-5
I have updated the listUsers function to support pagination and filtering. Now, I will remove the duplicate updateUserRole function to maintain code cleanliness and prevent potential conflicts. This will ensure that the controller has only one definition for updating a user's role, which is the more detailed and correct one. I will now proceed with removing the duplicate function.

admin.users.controller.js
src\controllers\admin.users.controller.js
+0
-40
I have removed the duplicate updateUserRole function. Now, I will update the admin.routes.js file to remove the duplicate route definition for updating a user's role. This will ensure that there is only one route for this action, which will prevent conflicts and keep the routing consistent. I will now read the contents of the file to proceed with this change.

src\routes\admin.routes.js
I will now remove the duplicate route definition for updating a user's role in c:\Users\a-abdulkareem\Documents\NAERA\G-FOX\api-fox\src\routes\admin.routes.js.

admin.routes.js
src\routes\admin.routes.js
+1
-2
I have completed the task of creating a paginated and filterable admin endpoint to get all users. I have also cleaned up the code by removing a duplicate function and route.

To summarize, I have:

Modified the listUsers controller to support pagination and filtering by search, role, and kycStatus.
Removed a duplicate updateUserRole function from the admin.users.controller.js file.
Removed a duplicate route for updating a user's role from the admin.routes.js file.
The new endpoint GET /api/admin/users is now ready to be used with the specified query parameters.

Closes #53

@ayshadogo ayshadogo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 🤝

@ayshadogo ayshadogo merged commit 6ba1215 into Dfunder:main Jun 20, 2026
1 check passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 20, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin: Get All Users (Paginated)

2 participants