If your MySQL in Local then add DB Credential .env
file in the root of the project with the following content:
DB_HOST=localhost
DB_USER=user
DB_PASSWORD=password
DB_NAME=myapp
run docker compose up
to run the MySQL container
we have only users table, run the SQL script in the db_script.sql
file.
run npm install
run npm start
- User Login
- User register
- User Get Info using User Token
pls add User Token as Bearer Token in Header should be
Authorization: Bearer
<user_token>
The application supports importing chat history from Excel files. This feature allows you to bulk import chat messages between users.
- Supported File Formats: Excel files only (.xlsx, .xls)
- Maximum File Size: 5MB
- File Limit: Only one file can be uploaded at a time
Your Excel file must contain the following columns:
I have added sample excel file sample_chat_messages.xlsx
sender_id
- ID of the message senderreceiver_id
- ID of the message recipientmessage
- Text content of the messagetimestamp
- Date and time of the message (format: YYYY-MM-DD HH:MM:SS)
Example:
sender_id | receiver_id | message | timestamp |
---|---|---|---|
1 | 2 | Hello, how are you? | 2023-06-15 10:30:00 |
2 | 1 | I'm doing well, thanks! | 2023-06-15 10:32:00 |
-
Authenticate First
- Send a POST request to
/user/login
with your credentials - Save the JWT token from the response
- Send a POST request to
-
Set Up the Import Request
- Create a new POST request to
/chat/import
- Under the "Authorization" tab:
- Select "Bearer Token" from the Type dropdown
- Paste your JWT token in the Token field
- Create a new POST request to
-
Attach the Excel File
- Select the "Body" tab
- Choose "form-data"
- Add a key named "chatFile"
- Click the dropdown on the right of the key and select "File"
- Click "Select File" and choose your Excel file
-
Send the Request
- Click the "Send" button
- You should receive a success response if the import was successful
-
Verify Import
- You can check the imported messages by querying your chat in the database, sql query is avaialble in
db_script.sql
file
- You can check the imported messages by querying your chat in the database, sql query is avaialble in