Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Implement an endpoint to export all users in an CSV file(only for super admin role) #427

Open
OBE96 opened this issue Feb 28, 2025 · 0 comments · May be fixed by #448
Open

[FEAT] Implement an endpoint to export all users in an CSV file(only for super admin role) #427

OBE96 opened this issue Feb 28, 2025 · 0 comments · May be fixed by #448
Assignees
Labels

Comments

@OBE96
Copy link

OBE96 commented Feb 28, 2025

Description:

Implement a new API endpoint that allows exporting the list of all users in a CSV file format. This functionality should be accessible only to users with the Super Admin role. The exported CSV should include the necessary user details (e.g., user ID, Fullname, email).

Acceptance Criteria

  • Only users with the Super Admin role should have access to this endpoint.
  • Admins can delete any comment.
  • Returns a 200 OK status with a success message when a comment is successfully deleted.
  • Returns a 401 Unauthorized access You must have Super Admin privileges to export user data.
  • Returns a 500 Internal Server Error if an unexpected issue occurs.

Expected Outcome

  • Successful User Data Export (Super Admin Only)
  • Unauthorized Access (Non-Super Admin)
  • Internal Server Errors (e.g., Database Failure)
  • Handling Large User Data Efficiently:

Endpoint:

The endpoint should be a GET request (e.g., GET /api/v1/users/export/csv).
The endpoint should return a CSV file containing all user data.

Responses

✅ Success Response

Status: 200 OK

🚫 Unauthorized Response

Status: 401 Unauthorized
json

{ 
    "success: "false",
    "message": "Unauthorized access. You must have Super Admin privileges to export user data.",
    "status_code": "401"
 }

CSV Format:

The CSV file should contain relevant columns such as:
User ID
Full Name
Email Address
The CSV should be properly formatted and downloadable.

Performance Considerations:

Ensure that the export process handles a large number of users efficiently.
The file should be generated in a reasonable time frame (e.g., < 30 seconds for 10,000 users).

Testing:

Implement unit and integration tests for the new endpoint.
Ensure that the Super Admin can successfully download the CSV, and non-Super Admin users are denied access.

@OBE96 OBE96 changed the title [FEAT] Implement an endpoint to export all users in an cvs file(only for super admin role) [FEAT] Implement an endpoint to export all users in an CSV file(only for super admin role) Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment