This Django Rest Framework project provides APIs for a social networking application.
To get started with this project, follow these steps:
- Clone the repository:
git clone <repository_url>
- Navigate to the project directory:
cd <project_directory>
- Build and run the Docker container:
docker-compose up --build
The above command will build the Docker image using the provided Dockerfile and docker-compose.yml, and then start the application. It will run the migrations, generate users, and start the Django development server.
POST /user/api/v1/signup/
- Description: Allows users to sign up with their email.
- Request Body:
{ "email": "user@example.com", "password": "password123", "name": "John Doe" }
- Response:
{ "success": true, "response": { "message": "Signup successfully Completed!" } }
POST /user/api/v1/login/
- Description: Allows users to log in with their email and password.
- Request Body:
{ "email": "user@example.com", "password": "password123" }
- Response:
{ "success": true, "response": { "message": "Login successful" } }
GET /user/api/v1/search/?q=<search_query>
- Description: Search for users by email or name.
- Parameters:
q
: Search query
- Response:
{ "count": 2, "next": null, "previous": null, "results": [ { "id": 3, "email": "user@example.com", "name": "user" }, { "id": 2, "email": "user2@example.com", "name": "user 2" } ] }
POST /social/api/v1/friend-request/
- Description: Send a friend request to another user.
- Request Body:
{ "action": "send", "friend_id": "2" }
- Response:
{ "success": true, "response": { "message": "Friend request sent successfully!" } }
POST /social/api/v1/friend-request/
- Description: Accept a friend request.
- Request Body:
{ "action": "accept", "friend_request_id": "1" }
- Response:
{ "success": true, "response": { "message": "Friend request accepted successfully" } }
POST /social/api/v1/friend-request/
- Description: Reject a friend request.
- Request Body:
{ "action": "reject", "friend_request_id": "2" }
- Response:
{ "success": true, "response": { "message": "Friend request rejected successfully!" } }
GET /social/api/v1/friends/
- Description: List all friends of the current user.
- Response:
{ "count": 0, "next": null, "previous": null, "results": [ { "id": 2, "email": "anotheruser@example.com", "name": "Jane Smith" } ] }
GET /social/api/v1/pending-friend-requests/
- Description: List all pending friend requests received by the current user.
- Response:
{ "count": 1, "next": null, "previous": null, "results": [ { "id": 2, "from_user": { "id": 4, "email": "sender@example.com", "name": "Sender Name" }, "to_user": { "id": 2, "email": "anotheruser@example.com", "name": "Receiver Name" } } ] }
- Users cannot send more than 3 friend requests within a minute.
- Python
- Django
- Django Rest Framework
- PostgreSQL
- Docker
- Docker Compose
- Git Version Control