This project is just a showcase for a chat system that is intended to work as a microservice in between multiple services.
- Ruby 3.1.2
- Rails (API only) 7.0.3
- Mysql
- Redis server 7.0.4
- Elasticsearch
- Sidekiq
-
Install
docker
which includes docker-compose from https://docs.docker.com/engine/install/ (if not installed) -
Clone the project's main branch:
[email protected]:abdulashref333/Instabug-Task.git
-
Head to the project root directory
cd Instabug-Task
-
NOTE: For Windows users you will need to convert
docker/entrypoint.sh
file line break type from CRLF to LF. -
Copy
.env.example
to.env
.cp docker/.env.example .env
-
Replace
APP_USER_ID
value in.env
with youruser ID
sed -i "/APP_USER_ID=/c\APP_USER_ID=$(id -u)" .env
-
Create project docker network
docker network create instabug_task_private_network
-
Run
docker compose up
You can now visit http://localhost:3000/
-
To open sidekiq dashboard
http://127.0.0.1:3000/sidekiq
-
To run the test specs
1. docker exec -it instabug_task bash # this will open a bash session inside the container
2. rspec # this will run the specs files.
- root path: /api/v1
Method | Endpoint | Description | Request Body |
---|---|---|---|
POST | /applications | Create new application | {"name": "application #1"} |
GET | /applications/:token | Get application data | |
PATCH | /applications/:token | Update application name | {"name": "application #2"} |
-------- | |||
POST | /applications/:token/chats | Create new chat | {} |
GET | /applications/:token/chats | Get List of chats for specific application | |
GET | /applications/:token/chats/:number | Get chat data | |
-------- | |||
POST | /applications/:token/chats/:number/messages | Add new message to specific chat | {"body": "test message body #2"} |
GET | /applications/:token/chats/:number/messages | Get List of messages for specific chat | |
GET | /applications/:token/chats/:number/messages/search | Search in chat message | |
GET | /applications/:token/chats/:number/messages/:message_number | Get message data | |
PATCH | /applications/:token/chats/:number/messages/:message_number | Update message data(body) | {"body": "test message body #3"} |
- Example of a full endpoint:
POST: http://localhost:3000/api/v1/applications
- Create Applications each with a unique token
- Upadate Applications
- Retrieve Application by token
- Create Chats entities for each application each with a unique number(started from 1,2,3,...)
- List Chats that are in each application
- Get specific chat in application by the application token & and chat number
- Create messages for each chat in application
- Update message
- List messages in each chat
- Search in messages which in a specific chat
- No Id's are returned back for any of the three entities(Application, Chat, Message)
- Specs file for each Model, Job, Controller.
- Add ovvercommit gem