-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description:
Build the complete Create, Read, Update, and Delete (CRUD) operations for managing users in the system. Reuse existing registerUser logic for creating users. This feature is essential for the admin panel and backend management tools.
✅ Tasks Checklist:
➕ Create User
- Create new endpoint:
POST /admin/add-user - Internally call
registerUser()method - Validate required fields (e.g., name, email, password, role)
- Hash password before storing
- Return success/error response
- Ensure admin-level authorization
📥 Get All Users
- Endpoint:
GET /users - Support pagination and filtering (optional)
- Return user list with metadata (e.g., count, page)
🔍 Get User by ID
- Endpoint:
GET /users/:id - Validate ID format
- Return 404 if user not found
- Return user data
✏️ Update User
- Endpoint:
PUT /users/:id - Allow updating name, email, role (optional password reset)
- Validate inputs
- Hash new password (if provided)
- Return updated user object
❌ Delete User
- Endpoint:
DELETE /users/:id - Decide on soft delete (e.g., set
isDeleted=true) or hard delete - Return confirmation response
🧪 Testing
- Unit tests for all endpoints
- Integration tests for full flow
📝 Documentation
- Update API docs (Swagger/Postman)
- Mention roles/permissions if required
🔒 Security
- Middleware for admin authorization
- Sanitize input data
- Use HTTPS and CORS as needed
Labels: backend, CRUD, user-service, admin, enhancement
Priority: 🔴 High
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels