@@ -80,32 +80,34 @@ collaboration service. It enables creating rooms, retrieving room details, and m
80
80
81
81
---
82
82
83
- ## Get Room IDs by User (JWT Authentication)
83
+ ## Get Room Details by Room ID
84
84
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.
87
86
88
87
- ** HTTP Method** : ` GET `
89
- - ** Endpoint** : ` /api/collaboration/room/user/rooms `
88
+ - ** Endpoint** : ` /api/collaboration/room/{roomId} `
90
89
91
90
### Authorization
92
91
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.
95
97
96
98
### Responses:
97
99
98
100
| Response Code | Explanation |
99
101
| -----------------------------| ---------------------------------------------|
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. |
102
104
| 500 (Internal Server Error) | Unexpected error in the server or database. |
103
105
104
106
### Command Line Example:
105
107
106
108
``` 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 " \
109
111
-H " Content-Type: application/json"
110
112
```
111
113
@@ -114,15 +116,41 @@ curl -X GET http://localhost:8080/api/collaboration/room/user/rooms \
114
116
``` json
115
117
{
116
118
"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
+ }
120
148
}
121
149
```
122
150
123
151
---
124
152
125
- ## Get Rooms by User ID, Room Status, and User's isForfeit status
153
+ ## Get Rooms by Room Status and User Forfeit status
126
154
127
155
This endpoint retrieves the details of rooms associated with the authenticated user, filtered by the specified room
128
156
status and isForfeit status using query parameters.
0 commit comments