@@ -50,15 +50,21 @@ async def create(question: CreateQuestionModel):
50
50
except DuplicateQuestionError as e :
51
51
raise HTTPException (status_code = 409 , detail = str (e ))
52
52
53
- @router .get ("/" , response_description = "Get all questions" , response_model = QuestionCollection )
53
+ @router .get ("/" ,
54
+ response_description = "Get all questions" ,
55
+ response_model = QuestionCollection
56
+ )
54
57
async def get_all (
55
58
category : Annotated [List [CategoryEnum | None ] | None , Query ()] = None ,
56
59
complexity : Annotated [ComplexityEnum | None , Query ()] = None ,
57
60
search : Annotated [str | None , Query ()] = None
58
61
):
59
62
return await get_all_questions (category , complexity , search )
60
63
61
- @router .get ("/{question_id}" , response_description = "Get question with specified id" , response_model = QuestionModel )
64
+ @router .get ("/{question_id}" ,
65
+ response_description = "Get question with specified id" ,
66
+ response_model = QuestionModel
67
+ )
62
68
async def get_question (question_id : str ):
63
69
try :
64
70
return await get_question_by_id (question_id )
@@ -67,7 +73,10 @@ async def get_question(question_id: str):
67
73
except QuestionNotFoundError as e :
68
74
raise HTTPException (status_code = 404 , detail = str (e ))
69
75
70
- @router .delete ("/{question_id}" , response_description = "Delete question with specified id" , response_model = MessageModel )
76
+ @router .delete ("/{question_id}" ,
77
+ response_description = "Delete question with specified id" ,
78
+ response_model = MessageModel
79
+ )
71
80
async def delete (question_id : str ):
72
81
try :
73
82
return await delete_question (question_id )
@@ -76,7 +85,10 @@ async def delete(question_id: str):
76
85
except QuestionNotFoundError as e :
77
86
raise HTTPException (status_code = 404 , detail = str (e ))
78
87
79
- @router .put ("/{question_id}" , response_description = "Update question with specified id" , response_model = QuestionModel )
88
+ @router .put ("/{question_id}" ,
89
+ response_description = "Update question with specified id" ,
90
+ response_model = QuestionModel
91
+ )
80
92
async def update_question (question_id : str , question_data : UpdateQuestionModel ):
81
93
try :
82
94
updated_question = await update_question_by_id (question_id , question_data )
@@ -109,10 +121,16 @@ async def batch_upload(questions: List[CreateQuestionModel]):
109
121
except BatchUploadFailedError as e :
110
122
raise HTTPException (status_code = 400 , detail = str (e ))
111
123
112
- @router .get ("/enum/category" , response_description = "Get all valid question categories" , response_model = List [CategoryEnum ])
124
+ @router .get ("/enum/categories" ,
125
+ response_description = "Get all valid question categories" ,
126
+ response_model = List [CategoryEnum ]
127
+ )
113
128
async def get_categories ():
114
129
return get_question_categories ()
115
130
116
- @router .get ("/enum/complexity" , response_description = "Get all valid question complexities" , response_model = List [ComplexityEnum ])
131
+ @router .get ("/enum/complexities" ,
132
+ response_description = "Get all valid question complexities" ,
133
+ response_model = List [ComplexityEnum ]
134
+ )
117
135
async def get_complexities ():
118
136
return get_question_complexities ()
0 commit comments