DevRocket
Pages

Admin Panel [TODO]

Documentation for the Admin Panel built with Angular and Nest.js, featuring user management via AdminUsersListComponent and AdminPanelComponent, and CSV export functionality.

Features

  • Manage users via the Admin Panel.
  • Display a list of users with search and filter options.
  • Export users to a CSV file.

Frontend (Angular)

Key Components

  1. AdminPanelComponent
    • Serves as the main container for the admin functionalities.
    • Provides navigation and integrates multiple subcomponents.
  2. AdminUsersListComponent
    • Displays a list of users.
    • Includes searching, filtering, and pagination.
    • Handles user-specific actions like editing and deletion.

Setup

  • Use <app-admin-panel></app-admin-panel> to display the admin panel interface.

Backend (Nest.js)

Key Endpoints

  1. GET /admin/users

    • Fetches the list of users.
    • Supports query parameters for pagination and filtering.
  2. GET /admin/users/export

    • Generates and downloads a CSV file with user data.

Setup

  • Ensure the AdminController and AdminService are registered in the AdminModule.
  • Configure necessary DTOs and validation pipes.

How to Export Users to CSV

  1. Navigate to the Admin Panel using <app-admin-panel>.
  2. Within the AdminUsersListComponent, click the Export to CSV button.
  3. The app generates a CSV file and triggers a download.

Additional Notes

  • Ensure CORS is configured in the Nest.js application if the Angular app is hosted on a different domain.
  • Add proper authentication and authorization to secure user data.
  • Use guards to restrict access to admin-specific routes.

On this page