Skip to content

Commit f70a5b6

Browse files
authored
Merge pull request #39 from CS3219-AY2425S1/feat/login
Feat/login
2 parents 53418d1 + 520bb06 commit f70a5b6

File tree

12 files changed

+1109
-86
lines changed

12 files changed

+1109
-86
lines changed

docs/peerprep.postman_collection.json

Lines changed: 159 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"_postman_id": "2b9fc136-67a7-4241-a816-a4cb71927c39",
44
"name": "peerprep",
55
"description": "# 🚀 Get started here\n\nThis template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\n\n## 🔖 **How to use this template**\n\n#### **Step 1: Send requests**\n\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\n\nThis collection contains each of these [request](https://learning.postman.com/docs/sending-requests/requests/) types. Open each request and click \"Send\" to see what happens.\n\n#### **Step 2: View responses**\n\nObserve the response tab for status code (200 OK), response time, and size.\n\n#### **Step 3: Send new Body data**\n\nUpdate or add new data in \"Body\" in the POST request. Typically, Body data is also used in PUT request.\n\n```\n{\n \"name\": \"Add your name in the body\"\n}\n\n ```\n\n#### **Step 4: Update the variable**\n\nVariables enable you to store and reuse values in Postman. We have created a [variable](https://learning.postman.com/docs/sending-requests/variables/) called `base_url` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\n\n#### **Step 5: Add tests in the \"Scripts\" tab**\n\nAdding tests to your requests can help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \"Test Results\" tab.\n\n<img src=\"https://content.pstmn.io/fa30ea0a-373d-4545-a668-e7b283cca343/aW1hZ2UucG5n\" width=\"2162\" height=\"1530\">\n\n## 💪 Pro tips\n\n- Use folders to group related requests and organize the collection.\n \n- Add more [scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/) to verify if the API works as expected and execute workflows.\n \n\n## 💡Related templates\n\n[API testing basics](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9a37a28-055b-49cd-8c7e-97494a21eb54&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \n[API documentation](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9c28f47-1253-44af-a2f3-20dce4da1f18&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \n[Authorization methods](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=31a9a6ed-4cdf-4ced-984c-d12c9aec1c27&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719)",
6-
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
7-
"_exporter_id": "24939823",
8-
"_collection_link": "https://cs3219-g11.postman.co/workspace/CS3219-G11~db882cad-4ce9-4503-8852-cda2be0074c7/collection/24939823-2b9fc136-67a7-4241-a816-a4cb71927c39?action=share&source=collection_link&creator=24939823"
6+
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
7+
"_exporter_id": "27257144",
8+
"_collection_link": "https://cs3219-g11.postman.co/workspace/CS3219-G11~db882cad-4ce9-4503-8852-cda2be0074c7/collection/24939823-2b9fc136-67a7-4241-a816-a4cb71927c39?action=share&source=collection_link&creator=27257144"
99
},
1010
"item": [
1111
{
@@ -30,16 +30,7 @@
3030
"request": {
3131
"method": "GET",
3232
"header": [],
33-
"url": {
34-
"raw": "{{question_base_url}}/questions/",
35-
"host": [
36-
"{{question_base_url}}"
37-
],
38-
"path": [
39-
"questions",
40-
""
41-
]
42-
},
33+
"url": "{{question_base_url}}/questions/",
4334
"description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data."
4435
},
4536
"response": []
@@ -76,16 +67,7 @@
7667
}
7768
}
7869
},
79-
"url": {
80-
"raw": "{{question_base_url}}/userquestions/",
81-
"host": [
82-
"{{question_base_url}}"
83-
],
84-
"path": [
85-
"userquestions",
86-
""
87-
]
88-
},
70+
"url": "{{question_base_url}}/userquestions/",
8971
"description": "This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. `id=1`).\n\nA successful DELETE request typically returns a `200 OK`, `202 Accepted`, or `204 No Content` response code."
9072
},
9173
"response": []
@@ -104,15 +86,7 @@
10486
}
10587
}
10688
},
107-
"url": {
108-
"raw": "{{question_base_url}}/questions",
109-
"host": [
110-
"{{question_base_url}}"
111-
],
112-
"path": [
113-
"questions"
114-
]
115-
}
89+
"url": "{{question_base_url}}/questions"
11690
},
11791
"response": []
11892
},
@@ -130,16 +104,7 @@
130104
}
131105
}
132106
},
133-
"url": {
134-
"raw": "{{question_base_url}}/questions/66f97b1bcdb0da00fc58084f",
135-
"host": [
136-
"{{question_base_url}}"
137-
],
138-
"path": [
139-
"questions",
140-
"66f97b1bcdb0da00fc58084f"
141-
]
142-
}
107+
"url": "{{question_base_url}}/questions/66f97b1bcdb0da00fc58084f"
143108
},
144109
"response": []
145110
},
@@ -148,16 +113,7 @@
148113
"request": {
149114
"method": "DELETE",
150115
"header": [],
151-
"url": {
152-
"raw": "{{question_base_url}}/questions/66f77d44d9fc757910483d70",
153-
"host": [
154-
"{{question_base_url}}"
155-
],
156-
"path": [
157-
"questions",
158-
"66f77d44d9fc757910483d70"
159-
]
160-
}
116+
"url": "{{question_base_url}}/questions/66fd5763302ba91314db6976"
161117
},
162118
"response": []
163119
}
@@ -173,22 +129,14 @@
173129
"header": [],
174130
"body": {
175131
"mode": "raw",
176-
"raw": "{\n \"email\": \"[email protected]\",\n \"name\": \"exampleUser\",\n \"password\": \"securePassword123\",\n \"type\": \"User\"\n}",
132+
"raw": "{\n \"username\": \"kurt\",\n \"email\": \"[email protected]\",\n \"password\": \"password\"\n}",
177133
"options": {
178134
"raw": {
179135
"language": "json"
180136
}
181137
}
182138
},
183-
"url": {
184-
"raw": "{{account_base_url}}/register",
185-
"host": [
186-
"{{account_base_url}}"
187-
],
188-
"path": [
189-
"register"
190-
]
191-
}
139+
"url": "{{account_base_url}}/users"
192140
},
193141
"response": []
194142
},
@@ -197,6 +145,33 @@
197145
"request": {
198146
"method": "POST",
199147
"header": [],
148+
"body": {
149+
"mode": "raw",
150+
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"password\"\n}",
151+
"options": {
152+
"raw": {
153+
"language": "json"
154+
}
155+
}
156+
},
157+
"url": "{{account_base_url}}/auth/login"
158+
},
159+
"response": []
160+
},
161+
{
162+
"name": "get user",
163+
"protocolProfileBehavior": {
164+
"disableBodyPruning": true
165+
},
166+
"request": {
167+
"method": "GET",
168+
"header": [
169+
{
170+
"key": "Authorization",
171+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE3Zjg0YTI3OGNlMDY0Yjg5NjY1NSIsImlhdCI6MTcyODE1MTkxMiwiZXhwIjoxNzI4MjM4MzEyfQ._jYUmdO3DsML96M9x6u5-vT5ZItFG593bjNriwGYdmk",
172+
"type": "text"
173+
}
174+
],
200175
"body": {
201176
"mode": "raw",
202177
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"securePassword123\"\n}",
@@ -206,37 +181,145 @@
206181
}
207182
}
208183
},
209-
"url": {
210-
"raw": "{{account_base_url}}/login",
211-
"host": [
212-
"{{account_base_url}}"
213-
],
214-
"path": [
215-
"login"
216-
]
217-
}
184+
"url": "{{account_base_url}}/users/67024e05b263c7aa3f74f1b3"
218185
},
219186
"response": []
220187
},
221188
{
222-
"name": "token login",
189+
"name": "get all user",
190+
"protocolProfileBehavior": {
191+
"disableBodyPruning": true
192+
},
223193
"request": {
224194
"method": "GET",
225-
"header": []
195+
"header": [
196+
{
197+
"key": "Authorization",
198+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE3Zjg0YTI3OGNlMDY0Yjg5NjY1NSIsImlhdCI6MTcyODE1MTkxMiwiZXhwIjoxNzI4MjM4MzEyfQ._jYUmdO3DsML96M9x6u5-vT5ZItFG593bjNriwGYdmk",
199+
"type": "text"
200+
}
201+
],
202+
"body": {
203+
"mode": "raw",
204+
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"securePassword123\"\n}",
205+
"options": {
206+
"raw": {
207+
"language": "json"
208+
}
209+
}
210+
},
211+
"url": "{{account_base_url}}/users"
212+
},
213+
"response": []
214+
},
215+
{
216+
"name": "update user",
217+
"request": {
218+
"method": "PATCH",
219+
"header": [
220+
{
221+
"key": "Authorization",
222+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE3Zjg0YTI3OGNlMDY0Yjg5NjY1NSIsImlhdCI6MTcyODE1MTkxMiwiZXhwIjoxNzI4MjM4MzEyfQ._jYUmdO3DsML96M9x6u5-vT5ZItFG593bjNriwGYdmk",
223+
"type": "text"
224+
}
225+
],
226+
"body": {
227+
"mode": "raw",
228+
"raw": "{\n \"username\": \"kurtyjlee\",\n \"email\": \"[email protected]\",\n \"password\": \"password\"\n}",
229+
"options": {
230+
"raw": {
231+
"language": "json"
232+
}
233+
}
234+
},
235+
"url": "{{account_base_url}}/users/67024c2cdcc1796f39ddaa26"
236+
},
237+
"response": []
238+
},
239+
{
240+
"name": "update user privileges",
241+
"request": {
242+
"method": "PATCH",
243+
"header": [
244+
{
245+
"key": "Authorization",
246+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE4NjE2YTAxYTk3NzE1MjdiOWJiMCIsImlhdCI6MTcyODE1MzEyMywiZXhwIjoxNzI4MjM5NTIzfQ._-3UN3f4czabZHWv_xZUACKFMGfF8X2zKw0-o2TxCJw",
247+
"type": "text"
248+
}
249+
],
250+
"body": {
251+
"mode": "raw",
252+
"raw": "{\n \"isAdmin\": true\n}",
253+
"options": {
254+
"raw": {
255+
"language": "json"
256+
}
257+
}
258+
},
259+
"url": "{{account_base_url}}/users/67024c2cdcc1796f39ddaa26/privilege"
226260
},
227261
"response": []
228262
},
229263
{
230-
"name": "Github OAuth",
264+
"name": "verify token",
265+
"protocolProfileBehavior": {
266+
"disableBodyPruning": true
267+
},
231268
"request": {
232269
"method": "GET",
233-
"header": []
270+
"header": [
271+
{
272+
"key": "Authorization",
273+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE3Zjg0YTI3OGNlMDY0Yjg5NjY1NSIsImlhdCI6MTcyODE1MTkxMiwiZXhwIjoxNzI4MjM4MzEyfQ._jYUmdO3DsML96M9x6u5-vT5ZItFG593bjNriwGYdmk",
274+
"type": "text"
275+
}
276+
],
277+
"body": {
278+
"mode": "raw",
279+
"raw": "",
280+
"options": {
281+
"raw": {
282+
"language": "json"
283+
}
284+
}
285+
},
286+
"url": "{{account_base_url}}/auth/verify-token"
287+
},
288+
"response": []
289+
},
290+
{
291+
"name": "delete user",
292+
"request": {
293+
"method": "DELETE",
294+
"header": [
295+
{
296+
"key": "Authorization",
297+
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDE4NWRhYTAxYTk3NzE1MjdiOWJhOCIsImlhdCI6MTcyODE1MzA3MywiZXhwIjoxNzI4MjM5NDczfQ.OHIWsunOyuHjuJ2s7OmSERmPSHsPCaw8N9t46uKloqk",
298+
"type": "text"
299+
}
300+
],
301+
"body": {
302+
"mode": "raw",
303+
"raw": "{\n \"isAdmin\": true\n}",
304+
"options": {
305+
"raw": {
306+
"language": "json"
307+
}
308+
}
309+
},
310+
"url": "{{account_base_url}}/users/67024c2cdcc1796f39ddaa26"
234311
},
235312
"response": []
236313
}
237314
]
238315
}
239316
],
317+
"auth": {
318+
"type": "bearer",
319+
"bearer": {
320+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDI0ZTA1YjI2M2M3YWEzZjc0ZjFiMyIsImlhdCI6MTcyODIwNDM0MSwiZXhwIjoxNzI4MjkwNzQxfQ.8ppV-YzpKIu0ldUsOIwbChYhdGNao5juYr2iea3D0JI"
321+
}
322+
},
240323
"event": [
241324
{
242325
"listen": "prerequest",
@@ -269,7 +352,7 @@
269352
},
270353
{
271354
"key": "account_base_url",
272-
"value": "localhost:4040",
355+
"value": "localhost:3001",
273356
"type": "string"
274357
}
275358
]

peerprep-fe/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"pre-commit": "pnpm format && git add -u"
1212
},
1313
"dependencies": {
14+
"@radix-ui/react-checkbox": "^1.1.1",
1415
"@radix-ui/react-dialog": "^1.1.1",
16+
"@radix-ui/react-dropdown-menu": "^2.1.2",
1517
"@radix-ui/react-icons": "^1.3.0",
1618
"@radix-ui/react-popover": "^1.1.1",
1719
"@radix-ui/react-select": "^2.1.1",

0 commit comments

Comments
 (0)