Skip to content

Feature: Admin Routes (CRUD) – Closes #15#51

Open
bhushan-ai wants to merge 1 commit intoajaybor0:mainfrom
bhushan-ai:feature/admin-endpoints
Open

Feature: Admin Routes (CRUD) – Closes #15#51
bhushan-ai wants to merge 1 commit intoajaybor0:mainfrom
bhushan-ai:feature/admin-endpoints

Conversation

@bhushan-ai
Copy link
Copy Markdown

@bhushan-ai bhushan-ai commented Sep 10, 2025

✨ Feature: Admin Routes (CRUD) – Closes #15

🔹 What’s Added

  • GET /admin/admin-list → Fetch all admins
  • POST /admin/admin-list/create → Create a new admin (with hashed password)
  • PUT /admin/admin-list/update/:id → Update admin details by ID
  • DELETE /admin/admin-list/delete/:id → Delete admin by ID

🔹 Implementation Details

  • Reused the existing User model (isAdmin: true) instead of creating a new Admin model.
  • Added validation for required fields (name, email, password).
  • Used bcrypt for secure password hashing.
  • Consistent error handling with next(error).

🔹 Why

Implements admin management functionality requested in Issue #15.

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.

Create new CRUD API Endpoint for Admin (Backend)

1 participant