https://github.com/rezoanulhasan/user-management-system
https://github.com/rezoanulhasan/user-management-system
jest-tests jwt mongoose redis-cache typescript winston-logger zod
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rezoanulhasan/user-management-system
- Owner: RezoanulHasan
- Created: 2024-04-25T15:05:20.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-03T10:27:13.000Z (about 2 years ago)
- Last Synced: 2025-02-25T15:51:01.329Z (over 1 year ago)
- Topics: jest-tests, jwt, mongoose, redis-cache, typescript, winston-logger, zod
- Language: TypeScript
- Homepage:
- Size: 304 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project-name: User-Management-System
## Project-type: Back-End
## API-documentation-link: https://documenter.getpostman.com/view/30665703/2sA3Bt3VGc
## Technology use
- Node js
- Express js
- Mongoose
- typescript
- Redis,Redis Pub/Sub
- Winston
- Jest
- JWT(validation)
- bcrypt (validation)
- Zod (validation)
- eslint ( code formatting and quality checking )
- prettier (maintain code structure)
## Proper Error handling
- Jwt Error
- Validation Error
- Cast Error
- Duplicate Entry
- Internal Server Error
# API Documentation
## Table of Contents for users
- **Endpoint:** `/api/auth/register`
- **Method:** `POST`
- **Request Body:** data formate like this \*
```json
{
"username": "your_username",
"password": "your_password",
"email": "your_email@example.com",
"phoneNumber":"your_number",
"address" : "your_address",
"role": "user"/"admin"
}
```
- **Endpoint:** `/api/auth/login`
- **Method:** `POST`
- **Request Body:** data formate like this \*
```json
{
"username": "your_username",
"password": "your_password"
}
```
- **Endpoint:** `/api/auth/change-Password`
- **Method:** `POST`
- **Access:** `Authenticated User `
- **Request Body:** data formate like this \*
- not use the same password more than two times.
```json
{
"currentPassword": "your_current_password",
"newPassword": "set_new_password"
}
```
## For update userinfo
- **Endpoint**: `PUT /api/users/:id`
- **Request Headers**:
- Authorization: ``
- **Access:** `admin`
- **Request Body:** data formate like this \*
- Admins can update their information or any user information.
```json
{
"username": "your_username",
"email": "your_email@example.com",
"age":"your_age",
"address" : "your_address",
"phoneNumber":"your_number"
}
```
### 9. Update My Profile
- Users can update their information such as name, image, email, address, and
phone number, but cannot perform any update operation on other users.
- **Endpoint**: `PUT /api/my-profile`
- **Request Headers**:
- Authorization: ``
- **Access:** `admin` and `user`
-
```json
{
"username": "your_username",
"email": "your_email@example.com",
"age":"your_age",
"address" : "your_address",
"phoneNumber":"your_number"
}
```
## For ADMIN
### Get all users with pagination
- **Endpoint:** `/api/users`
- **Method:** `GET`
- **Access:** `admin`
### Get single user by ID
- **Endpoint:** `/api/users/:id`
- **Method:** `GET`
- **Access:** `admin`
### Delete a user
- Delete form user model and user profile
- **Endpoint:** `/api/users/:id`
- **Method:** `Delete`
- **Access:** `admin`
## Getting Started
to set up and run projects locally
- download this repository
- npm install
- npm run build
- npm run start: dev
- and also set-up Redis in you environment