Skip to content

Commit c3215a4

Browse files
committed
Update README.md for Collaboration Service
1 parent 0fc40fe commit c3215a4

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed

services/collaboration/README.md

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,34 @@ collaboration service. It enables creating rooms, retrieving room details, and m
8080

8181
---
8282

83-
## Get Room IDs by User (JWT Authentication)
83+
## Get Room Details by Room ID
8484

85-
This endpoint retrieves all active room IDs associated with the authenticated user. Only rooms where `room_status`
86-
is `true` will be retrieved.
85+
This endpoint retrieves detailed information for rooms by its Room ID.
8786

8887
- **HTTP Method**: `GET`
89-
- **Endpoint**: `/api/collaboration/room/user/rooms`
88+
- **Endpoint**: `/api/collaboration/room/{roomId}`
9089

9190
### Authorization
9291

93-
This endpoint requires a valid JWT token in the `Authorization` header. The `userId` is derived from the token and is
94-
not provided directly.
92+
This endpoint requires a valid JWT token in the Authorization header.
93+
94+
### Parameters:
95+
96+
- `roomId` (Required) - The unique identifier of the room to retrieve details for.
9597

9698
### Responses:
9799

98100
| Response Code | Explanation |
99101
|-----------------------------|---------------------------------------------|
100-
| 200 (OK) | Success, room IDs retrieved. |
101-
| 404 (Not Found) | No rooms found for the user. |
102+
| 200 (OK) | Success, room details returned. |
103+
| 404 (Not Found) | Room not found. |
102104
| 500 (Internal Server Error) | Unexpected error in the server or database. |
103105

104106
### Command Line Example:
105107

106108
```bash
107-
curl -X GET http://localhost:8080/api/collaboration/room/user/rooms \
108-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MjRlOTZlNDNjMmNjNWQ5ODA5NmM2OSIsInVzZXJuYW1lIjoiVGVzdGluZzEiLCJyb2xlIjoidXNlciIsImlhdCI6MTczMDQ3MjMwMywiZXhwIjoxNzMwNTU4NzAzfQ.x92l-NIgWj_dpM-EC-xOKAGB8zrgGAdKbDpAu3UD5vE" \
109+
curl -X GET "http://localhost:8080/api/collaboration/room/67277d28b6335f6dc76f599a" \
110+
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MjFhNWZiZWFlNjBjOGViMWU1ZWYzNCIsInVzZXJuYW1lIjoiVGVzdGluZzEiLCJyb2xlIjoidXNlciIsImlhdCI6MTczMDQ3MjY2NCwiZXhwIjoxNzMwNTYxMDY0fQ.DF9CaChoG3-UmeZgZG9SlpjtTknVzeVSBAJDJRdqGk0" \
109111
-H "Content-Type: application/json"
110112
```
111113

@@ -114,15 +116,41 @@ curl -X GET http://localhost:8080/api/collaboration/room/user/rooms \
114116
```json
115117
{
116118
"status": "Success",
117-
"data": [
118-
"6724e9d892fb3e9f04c2e280"
119-
]
119+
"data": {
120+
"room_id": "67277d28b6335f6dc76f599a",
121+
"users": [
122+
{
123+
"id": "67277d044012b8a652616454",
124+
"username": "Testing",
125+
"requestId": "67277d2850d5e18cfc11cd79",
126+
"isForfeit": true
127+
},
128+
{
129+
"id": "67277d104012b8a65261645a",
130+
"username": "Testing1",
131+
"requestId": "67277d2450d5e18cfc11cd74",
132+
"isForfeit": true
133+
}
134+
],
135+
"question": {
136+
"_id": "67277cec70d0a5c9b36304fc",
137+
"id": 3,
138+
"description": "Given a roman numeral, convert it to an integer.",
139+
"difficulty": "Easy",
140+
"title": "Roman to Integer",
141+
"topics": [
142+
"Algorithms"
143+
]
144+
},
145+
"createdAt": "2024-11-03T13:39:52.591Z",
146+
"room_status": false
147+
}
120148
}
121149
```
122150

123151
---
124152

125-
## Get Rooms by User ID, Room Status, and User's isForfeit status
153+
## Get Rooms by Room Status and User Forfeit status
126154

127155
This endpoint retrieves the details of rooms associated with the authenticated user, filtered by the specified room
128156
status and isForfeit status using query parameters.

0 commit comments

Comments
 (0)