/src
├── auth/ # Authentication module (guards, strategies)
├── decorators/ # Custom decorators for user and friendship validation
├── dto/ # Data transfer objects (DTOs) for request validation
├── pipes/ # NestJS pipes for advanced validation
├── services/ # Business logic (UserService)
├── guards/ # Security guards (AuthGuard, FriendshipGuard)
├── user.controller.ts # API controller handling user routes
├── user.service.ts # Business logic and data management
├── main.ts # Application entry point
Ensure you have the following installed:
- Node.js (>=16.x)
- PostgreSQL or a compatible database
- Prisma CLI
- Clone the repository and install dependencies:
git clone git@github.com:Aram47/M-One-Task.git
cd m-one-task
npm install- Set up environment variables:
Create a
.envfile and configure it with the following:
DATABASE_URL="your_database_connection_string"
JWT_SECRET="your_secret_key"- Run Prisma migrations:
npx prisma migrate dev --name init- Start the server:
npm run start:dev- Ensure Docker is installed and running.
- Run the application using Docker Compose:
docker-compose up --buildThis will start the application and a PostgreSQL database container.
| Method | Endpoint | Description |
|---|---|---|
| GET | /user/getById/:id |
Retrieve a user by ID |
| GET | /user |
Search users |
| PATCH | /user/editUser/:id |
Update user details |
| DELETE | /user/:id |
Remove a user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /user/sendFriendRequest/:id |
Send a friend request |
| GET | /user/getFriendRequests |
Fetch pending friend requests |
| PATCH | /user/resolveFriendRequest/:id |
Accept or reject a friend request |
🔧 Built with NestJS, Prisma, and PostgreSQL