Skip to content

Commit 95c4072

Browse files
committed
Update documentation
1 parent 7b361c1 commit 95c4072

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

backend/question/docs/question.plantuml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ entity Pagination {
2323
interface IQuestionServiceAPI {
2424
+ GET /
2525
+ POST /create [createQuestion: EditQuestion]
26-
+ POST /all [pagination: Pagination]
26+
+ POST /all [pagination: Pagination, title: string, complexity: string[], category: string[]]
2727
+ GET /{id}
2828
+ POST /{id}/update [updateQuestion: EditQuestion]
2929
+ POST /{id}/delete
30+
+ POST /pick-question [complexity: string[], category: string[]]
3031
}
3132

3233
note right of IQuestionServiceAPI
3334
- GET /: Check service status
3435
- POST /create: Create a new question
35-
- POST /all: Retrieve all questions with pagination
36+
- POST /all: Retrieve all questions with pagination (Supports filtering by title, complexiy and category)
3637
- GET /{id}: Retrieve a specific question by ID
3738
- POST /{id}/update: Update a specific question by ID
3839
- POST /{id}/delete: Delete a specific question by ID
40+
- POST /pick-question: Pick a random question given a list of complexities and categories
3941
end note
4042

4143
class QuestionService {

backend/question/docs/question.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,39 @@ paths:
6666
type: integer
6767
default: 1
6868
description: Page number
69+
example: 1
6970
page_size:
7071
type: integer
7172
default: 10
7273
description: Number of questions per page
74+
example: 10
75+
title:
76+
type: string
77+
default: ""
78+
description: Filter by title
79+
example: "Two Sum"
80+
complexity:
81+
type: array
82+
items:
83+
type: string
84+
default: []
85+
description: Filter by complexities
86+
example: ["Easy", "Medium", "Hard"]
87+
category:
88+
type: array
89+
items:
90+
type: string
91+
default: []
92+
description: Filter by categories
93+
example:
94+
[
95+
"Hash Table",
96+
"Array",
97+
"Linked List",
98+
"Dynamic Programming",
99+
"Math",
100+
"String",
101+
]
73102
responses:
74103
"200":
75104
description: List of questions
@@ -155,6 +184,43 @@ paths:
155184
description: Question not found
156185
"500":
157186
description: Internal server error
187+
/pick-question:
188+
post:
189+
summary: Pick a random question given a list of complexities and categories
190+
requestBody:
191+
content:
192+
application/json:
193+
schema:
194+
type: object
195+
properties:
196+
complexity:
197+
type: array
198+
items:
199+
type: string
200+
default: []
201+
description: Filter by complexities
202+
example: ["Easy"]
203+
category:
204+
type: array
205+
items:
206+
type: string
207+
default: []
208+
description: Filter by categories
209+
example: ["Hash Table"]
210+
211+
responses:
212+
"200":
213+
description: Question picked
214+
content:
215+
application/json:
216+
schema:
217+
$ref: "#/components/schemas/Question"
218+
"400":
219+
description: Bad Request (validation error)
220+
"404":
221+
description: No Question found
222+
"500":
223+
description: Internal server error
158224

159225
components:
160226
schemas:

0 commit comments

Comments
 (0)