This project provides a robust API for managing user operations and interactions within the Plena Finance system. It offers functionalities for user creation, retrieval, updating, deletion, blocking, unblocking, and searching, ensuring comprehensive user management capabilities.
- User Management: Create, Read, Update, Delete User (CRUD operations).
- Block/Unblock User: Block or unblock users to manage access and interactions.
- Search Users: Search for users based on specified criteria.
- Backend: Node.js, NestJS
- Database: MongoDB (for user data), Redis (for caching)
- Others: Postman (for API testing and documentation)
- Node.js
- MongoDB
- Redis
- NestJS
- Clone the repository:
git clone https://github.com/ahmedrzakhan/plena-finance-user.git
Navigate to the project directory:
cd plena-finance-user
Install the dependencies:
npm install
Set up the environment variables: Create a .env file in the root directory. Add the following environment variables:
MONGODB_URI=your_mongodb_uri
REDIS_HOST=your_redis_host
REDIS_PORT=your_redis_port
REDIS_PASSWORD=your_redis_password
Start the server:
npm start
You can find the Postman collection with all the API endpoints
The Postman collection includes all necessary endpoints for the project. Each endpoint is documented with:
- HTTP method
- Request URL
- Required headers
- Request body (if applicable)
- Example responses
GET /api/user/:id - Get user by ID
CREATE /api/user - Create user by unique username
PUT /api/user/:id - Update user by ID
DELETE /api/user/:id - Delete user by ID
POST blocked-users/:userId/block - Blocks a user specified by userId.
POST blocked-users/:userId/unblock - Unblocks a user specified by userId.
GET user/:userId/actions/search - Retrieves users filtered by the provided criteria, excluding those who have been blocked.
Parameters:
username: Specifies the username to search for.
minAge (optional): Specifies the minimum age for filtering users.
maxAge (optional): Specifies the maximum age for filtering users.
To ensure the quality and functionality of the application, have implemented various test cases. You can run these tests using the following command:
npm test
Contact
- Author: Ahmed Raza Khan
- Email: [email protected]
- LinkedIn: Ahmed Raza Khan