The goal is to develop a chat server that provides an HTTP API for working with chats and user messages.
Source: https://solvit.space/test-tasks/1
- Core entities:
- Main API methods:
- Add a new user.
curl -X POST "http://127.0.0.1:9000/users/create-user" -H "Content-Type: application/json" -d '{"username": "test"}'
- Create a new chat between users.
curl -X POST "http://127.0.0.1:9000/chats/create-chat" -H "Content-Type: application/json" -d '{"name": "test", "users": [1, 2, 3]}'
- Get the list of chats for a specific user.
curl -X GET "http://127.0.0.1:9000/chats/get-chats/user/1" - Send a message to a chat on behalf of a user.
curl -X POST "http://127.0.0.1:9000/messages/create-message" -H "Content-Type: application/json" -d '{"chat_id": 1, "author_id": 1, "text": "test"}'
- Get the list of messages in a specific chat.
curl -X GET "http://127.0.0.1:9000/messages/get-messages/chat/1"
- Add a new user.
-
- Provide instructions for running the application.
-
- Use containerization with the ability to run the project using
docker-compose up.sudo systemctl restart docker docker ps -a docker compose up --build docker compose down -v # optional
- Use containerization with the ability to run the project using
-
- Add test coverage.
Project uses SQLAlchemy, Pydantic and PostgreSQL.
git clone https://github.com/onesch/avito-Intern-backend-task.git
cd avito-Intern-backend-taskpip install uv
# or
curl -Ls https://astral.sh/uv/install.sh | shuv synccp .env.example .envcreatedb chat_dbmake run
# or
uv run uvicorn app.main:app --reload --port 9000