OrderManager is a service for managing chat rooms, sending messages, and handling chat-related operations through WebSocket.
- Create an
.env
file with the sample.env.example
file. - Create a PostgreSQL database table.
- Update the Database URL and other variables in the
.env
file. - Change directory to the project directory.
- Run migration with:
npx prisma migrate dev --name init
- Run:
npx prisma generate
- Run this to create an Admin user:
npx ts-node prisma/seed.ts
- Install dependencies:
yarn install
- Start the application:
yarn start:dev
- API Docs URL:
http://localhost:3000/docs
- WebSocket URL:
ws://localhost:3001
Event: sendMessage
Request:
{
"event": "sendMessage",
"data": {
"content": "Hello, World!",
"chatRoomId": "room-id",
"userId": "user-id"
}
}
Event: closeChatRoom
Request:
{
"event": "closeChatRoom",
"data": {
"chatRoomId": "room-id",
"userId": "admin-id",
"closeChatRoomDto": {
"summary": "Room is closed for review",
"orderId": "order-id"
}
}
}
Event: getMessages
Request:
{
"event": "getMessages",
"data": {
"chatRoomId": "room-id",
"userId": "user-id"
}
}
- Replace
room-id
,user-id
,admin-id
, andorder-id
with actual values. - Ensure the database is running and the
.env
file is correctly configured before starting the application.