Browse Source

rename endpoints swagger tags constants

Guénaël Muller 5 years ago
parent
commit
8c9feae41e

+ 4 - 4
backend/tracim_backend/views/contents_api/comment_controller.py View File

@@ -24,12 +24,12 @@ from tracim_backend.models.contents import ContentTypeLegacy as ContentType
24 24
 from tracim_backend.models.revision_protection import new_revision
25 25
 from tracim_backend.models.data import UserRoleInWorkspace
26 26
 
27
-COMMENT_ENDPOINTS_TAG = 'Comments'
27
+SWAGGER_TAG__COMMENT_ENDPOINTS = 'Comments'
28 28
 
29 29
 
30 30
 class CommentController(Controller):
31 31
 
32
-    @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG])
32
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS])
33 33
     @require_workspace_role(UserRoleInWorkspace.READER)
34 34
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
35 35
     @hapic.output_body(CommentSchema(many=True))
@@ -55,7 +55,7 @@ class CommentController(Controller):
55 55
                 for comment in comments
56 56
         ]
57 57
 
58
-    @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG])
58
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS])
59 59
     @hapic.handle_exception(EmptyCommentContentNotAllowed, HTTPStatus.BAD_REQUEST)  # nopep8
60 60
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
61 61
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -84,7 +84,7 @@ class CommentController(Controller):
84 84
         )
85 85
         return api.get_content_in_context(comment)
86 86
 
87
-    @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG])
87
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS])
88 88
     @require_comment_ownership_or_role(
89 89
         minimal_required_role_for_anyone=UserRoleInWorkspace.WORKSPACE_MANAGER,
90 90
         minimal_required_role_for_owner=UserRoleInWorkspace.CONTRIBUTOR,

+ 15 - 15
backend/tracim_backend/views/contents_api/file_controller.py View File

@@ -39,7 +39,7 @@ from tracim_backend.exceptions import EmptyLabelNotAllowed
39 39
 from tracim_backend.exceptions import PageOfPreviewNotFound
40 40
 from tracim_backend.exceptions import PreviewDimNotAllowed
41 41
 
42
-FILE_ENDPOINTS_TAG = 'Files'
42
+SWAGGER_TAG__FILE_ENDPOINTS = 'Files'
43 43
 
44 44
 
45 45
 class FileController(Controller):
@@ -48,7 +48,7 @@ class FileController(Controller):
48 48
     """
49 49
 
50 50
     # File data
51
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
51
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
52 52
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
53 53
     @require_content_types([file_type])
54 54
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -84,7 +84,7 @@ class FileController(Controller):
84 84
 
85 85
         return
86 86
 
87
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
87
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
88 88
     @require_workspace_role(UserRoleInWorkspace.READER)
89 89
     @require_content_types([file_type])
90 90
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -109,7 +109,7 @@ class FileController(Controller):
109 109
         response.app_iter = FileIter(file)
110 110
         return response
111 111
 
112
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
112
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
113 113
     @require_workspace_role(UserRoleInWorkspace.READER)
114 114
     @require_content_types([file_type])
115 115
     @hapic.input_path(WorkspaceAndContentRevisionIdPathSchema())
@@ -140,7 +140,7 @@ class FileController(Controller):
140 140
 
141 141
     # preview
142 142
     # pdf
143
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
143
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
144 144
     @require_workspace_role(UserRoleInWorkspace.READER)
145 145
     @require_content_types([file_type])
146 146
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
@@ -169,7 +169,7 @@ class FileController(Controller):
169 169
         )
170 170
         return FileResponse(pdf_preview_path)
171 171
 
172
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
172
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
173 173
     @require_workspace_role(UserRoleInWorkspace.READER)
174 174
     @require_content_types([file_type])
175 175
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
@@ -192,7 +192,7 @@ class FileController(Controller):
192 192
         pdf_preview_path = api.get_full_pdf_preview_path(content.revision_id)
193 193
         return FileResponse(pdf_preview_path)
194 194
 
195
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
195
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
196 196
     @require_workspace_role(UserRoleInWorkspace.READER)
197 197
     @require_content_types([file_type])
198 198
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
@@ -225,7 +225,7 @@ class FileController(Controller):
225 225
         return FileResponse(pdf_preview_path)
226 226
 
227 227
     # jpg
228
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
228
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
229 229
     @require_workspace_role(UserRoleInWorkspace.READER)
230 230
     @require_content_types([file_type])
231 231
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
@@ -256,7 +256,7 @@ class FileController(Controller):
256 256
         )
257 257
         return FileResponse(jpg_preview_path)
258 258
 
259
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
259
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
260 260
     @require_workspace_role(UserRoleInWorkspace.READER)
261 261
     @require_content_types([file_type])
262 262
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
@@ -287,7 +287,7 @@ class FileController(Controller):
287 287
         )
288 288
         return FileResponse(jpg_preview_path)
289 289
 
290
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
290
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
291 291
     @require_workspace_role(UserRoleInWorkspace.READER)
292 292
     @require_content_types([file_type])
293 293
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
@@ -322,7 +322,7 @@ class FileController(Controller):
322 322
         )
323 323
         return FileResponse(jpg_preview_path)
324 324
 
325
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
325
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
326 326
     @require_workspace_role(UserRoleInWorkspace.READER)
327 327
     @require_content_types([file_type])
328 328
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -341,7 +341,7 @@ class FileController(Controller):
341 341
         return api.get_jpg_preview_allowed_dim()
342 342
 
343 343
     # File infos
344
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
344
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
345 345
     @require_workspace_role(UserRoleInWorkspace.READER)
346 346
     @require_content_types([file_type])
347 347
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -362,7 +362,7 @@ class FileController(Controller):
362 362
         )
363 363
         return api.get_content_in_context(content)
364 364
 
365
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
365
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
366 366
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
367 367
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
368 368
     @require_content_types([file_type])
@@ -397,7 +397,7 @@ class FileController(Controller):
397 397
             api.save(content)
398 398
         return api.get_content_in_context(content)
399 399
 
400
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
400
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
401 401
     @require_workspace_role(UserRoleInWorkspace.READER)
402 402
     @require_content_types([file_type])
403 403
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -427,7 +427,7 @@ class FileController(Controller):
427 427
             for revision in revisions
428 428
         ]
429 429
 
430
-    @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
430
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
431 431
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
432 432
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
433 433
     @require_content_types([file_type])

+ 5 - 5
backend/tracim_backend/views/contents_api/html_document_controller.py View File

@@ -30,12 +30,12 @@ from tracim_backend.models.contents import ContentTypeLegacy as ContentType
30 30
 from tracim_backend.models.contents import html_documents_type
31 31
 from tracim_backend.models.revision_protection import new_revision
32 32
 
33
-HTML_DOCUMENT_ENDPOINTS_TAG = 'HTML documents'
33
+SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS = 'HTML documents'
34 34
 
35 35
 
36 36
 class HTMLDocumentController(Controller):
37 37
 
38
-    @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG])
38
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
39 39
     @require_workspace_role(UserRoleInWorkspace.READER)
40 40
     @require_content_types([html_documents_type])
41 41
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -56,7 +56,7 @@ class HTMLDocumentController(Controller):
56 56
         )
57 57
         return api.get_content_in_context(content)
58 58
 
59
-    @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG])
59
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
60 60
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
61 61
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
62 62
     @require_content_types([html_documents_type])
@@ -91,7 +91,7 @@ class HTMLDocumentController(Controller):
91 91
             api.save(content)
92 92
         return api.get_content_in_context(content)
93 93
 
94
-    @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG])
94
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
95 95
     @require_workspace_role(UserRoleInWorkspace.READER)
96 96
     @require_content_types([html_documents_type])
97 97
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -121,7 +121,7 @@ class HTMLDocumentController(Controller):
121 121
             for revision in revisions
122 122
         ]
123 123
 
124
-    @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG])
124
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
125 125
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
126 126
     @require_content_types([html_documents_type])
127 127
     @hapic.input_path(WorkspaceAndContentIdPathSchema())

+ 5 - 5
backend/tracim_backend/views/contents_api/threads_controller.py View File

@@ -29,12 +29,12 @@ from tracim_backend.models.contents import ContentTypeLegacy as ContentType
29 29
 from tracim_backend.models.contents import thread_type
30 30
 from tracim_backend.models.revision_protection import new_revision
31 31
 
32
-THREAD_ENDPOINTS_TAG = 'Threads'
32
+SWAGGER_TAG__THREAD_ENDPOINTS = 'Threads'
33 33
 
34 34
 
35 35
 class ThreadController(Controller):
36 36
 
37
-    @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG])
37
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
38 38
     @require_workspace_role(UserRoleInWorkspace.READER)
39 39
     @require_content_types([thread_type])
40 40
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -55,7 +55,7 @@ class ThreadController(Controller):
55 55
         )
56 56
         return api.get_content_in_context(content)
57 57
 
58
-    @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG])
58
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
59 59
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
60 60
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
61 61
     @require_content_types([thread_type])
@@ -90,7 +90,7 @@ class ThreadController(Controller):
90 90
             api.save(content)
91 91
         return api.get_content_in_context(content)
92 92
 
93
-    @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG])
93
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
94 94
     @require_workspace_role(UserRoleInWorkspace.READER)
95 95
     @require_content_types([thread_type])
96 96
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
@@ -120,7 +120,7 @@ class ThreadController(Controller):
120 120
             for revision in revisions
121 121
         ]
122 122
 
123
-    @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG])
123
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
124 124
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
125 125
     @require_content_types([thread_type])
126 126
     @hapic.input_path(WorkspaceAndContentIdPathSchema())

+ 4 - 4
backend/tracim_backend/views/core_api/session_controller.py View File

@@ -16,12 +16,12 @@ from tracim_backend.views.core_api.schemas import BasicAuthSchema
16 16
 from tracim_backend.exceptions import NotAuthenticated
17 17
 from tracim_backend.exceptions import AuthenticationFailed
18 18
 
19
-SESSION_ENDPOINTS_TAG = 'Session'
19
+SWAGGER_TAG__SESSION_ENDPOINTS = 'Session'
20 20
 
21 21
 
22 22
 class SessionController(Controller):
23 23
 
24
-    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
24
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS])
25 25
     @hapic.input_headers(LoginOutputHeaders())
26 26
     @hapic.input_body(BasicAuthSchema())
27 27
     # TODO - G.M - 17-04-2018 - fix output header ?
@@ -42,7 +42,7 @@ class SessionController(Controller):
42 42
         user = uapi.authenticate_user(login.email, login.password)
43 43
         return uapi.get_user_with_context(user)
44 44
 
45
-    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
45
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS])
46 46
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
47 47
     def logout(self, context, request: TracimRequest, hapic_data=None):
48 48
         """
@@ -51,7 +51,7 @@ class SessionController(Controller):
51 51
 
52 52
         return
53 53
 
54
-    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
54
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS])
55 55
     @hapic.output_body(UserSchema(),)
56 56
     def whoami(self, context, request: TracimRequest, hapic_data=None):
57 57
         """

+ 3 - 3
backend/tracim_backend/views/core_api/system_controller.py View File

@@ -18,12 +18,12 @@ from tracim_backend.views.controllers import Controller
18 18
 from tracim_backend.views.core_api.schemas import ApplicationSchema
19 19
 from tracim_backend.views.core_api.schemas import ContentTypeSchema
20 20
 
21
-SYSTEM_ENDPOINTS_TAG = 'System'
21
+SWAGGER_TAG_SYSTEM_ENDPOINTS = 'System'
22 22
 
23 23
 
24 24
 class SystemController(Controller):
25 25
 
26
-    @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG])
26
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_SYSTEM_ENDPOINTS])
27 27
     @require_profile(Group.TIM_USER)
28 28
     @hapic.output_body(ApplicationSchema(many=True),)
29 29
     def applications(self, context, request: TracimRequest, hapic_data=None):
@@ -32,7 +32,7 @@ class SystemController(Controller):
32 32
         """
33 33
         return applications
34 34
 
35
-    @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG])
35
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_SYSTEM_ENDPOINTS])
36 36
     @require_profile(Group.TIM_USER)
37 37
     @hapic.output_body(ContentTypeSchema(many=True),)
38 38
     def content_types(self, context, request: TracimRequest, hapic_data=None):

+ 15 - 15
backend/tracim_backend/views/core_api/user_controller.py View File

@@ -32,12 +32,12 @@ from tracim_backend.views.core_api.schemas import ContentDigestSchema
32 32
 from tracim_backend.views.core_api.schemas import ActiveContentFilterQuerySchema
33 33
 from tracim_backend.views.core_api.schemas import WorkspaceDigestSchema
34 34
 
35
-USER_ENDPOINTS_TAG = 'Users'
35
+SWAGGER_TAG__USER_ENDPOINTS = 'Users'
36 36
 
37 37
 
38 38
 class UserController(Controller):
39 39
 
40
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
40
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
41 41
     @require_same_user_or_profile(Group.TIM_ADMIN)
42 42
     @hapic.input_path(UserIdPathSchema())
43 43
     @hapic.output_body(WorkspaceDigestSchema(many=True),)
@@ -58,7 +58,7 @@ class UserController(Controller):
58 58
             for workspace in workspaces
59 59
         ]
60 60
 
61
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
61
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
62 62
     @require_same_user_or_profile(Group.TIM_ADMIN)
63 63
     @hapic.input_path(UserIdPathSchema())
64 64
     @hapic.output_body(UserSchema())
@@ -74,7 +74,7 @@ class UserController(Controller):
74 74
         )
75 75
         return uapi.get_user_with_context(request.candidate_user)
76 76
 
77
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
77
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
78 78
     @hapic.handle_exception(WrongUserPassword, HTTPStatus.FORBIDDEN)
79 79
     @require_same_user_or_profile(Group.TIM_ADMIN)
80 80
     @hapic.input_body(SetEmailSchema())
@@ -98,7 +98,7 @@ class UserController(Controller):
98 98
         )
99 99
         return uapi.get_user_with_context(user)
100 100
 
101
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
101
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
102 102
     @hapic.handle_exception(WrongUserPassword, HTTPStatus.FORBIDDEN)
103 103
     @hapic.handle_exception(PasswordDoNotMatch, HTTPStatus.BAD_REQUEST)
104 104
     @require_same_user_or_profile(Group.TIM_ADMIN)
@@ -124,7 +124,7 @@ class UserController(Controller):
124 124
         )
125 125
         return
126 126
 
127
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
127
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
128 128
     @require_same_user_or_profile(Group.TIM_ADMIN)
129 129
     @hapic.input_body(UserInfosSchema())
130 130
     @hapic.input_path(UserIdPathSchema())
@@ -147,7 +147,7 @@ class UserController(Controller):
147 147
         )
148 148
         return uapi.get_user_with_context(user)
149 149
 
150
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
150
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
151 151
     @require_profile(Group.TIM_ADMIN)
152 152
     @hapic.input_path(UserIdPathSchema())
153 153
     @hapic.input_body(UserCreationSchema())
@@ -179,7 +179,7 @@ class UserController(Controller):
179 179
         )
180 180
         return uapi.get_user_with_context(user)
181 181
 
182
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
182
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
183 183
     @require_profile(Group.TIM_ADMIN)
184 184
     @hapic.input_path(UserIdPathSchema())
185 185
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -196,7 +196,7 @@ class UserController(Controller):
196 196
         uapi.enable(user=request.candidate_user, do_save=True)
197 197
         return
198 198
 
199
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
199
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
200 200
     @require_profile(Group.TIM_ADMIN)
201 201
     @hapic.input_path(UserIdPathSchema())
202 202
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -213,7 +213,7 @@ class UserController(Controller):
213 213
         uapi.disable(user=request.candidate_user, do_save=True)
214 214
         return
215 215
 
216
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
216
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
217 217
     @require_profile(Group.TIM_ADMIN)
218 218
     @hapic.input_path(UserIdPathSchema())
219 219
     @hapic.input_body(UserProfileSchema())
@@ -241,7 +241,7 @@ class UserController(Controller):
241 241
         )
242 242
         return
243 243
 
244
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
244
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
245 245
     @require_same_user_or_profile(Group.TIM_ADMIN)
246 246
     @hapic.input_path(UserWorkspaceIdPathSchema())
247 247
     @hapic.input_query(ActiveContentFilterQuerySchema())
@@ -275,7 +275,7 @@ class UserController(Controller):
275 275
             for content in last_actives
276 276
         ]
277 277
 
278
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
278
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
279 279
     @require_same_user_or_profile(Group.TIM_ADMIN)
280 280
     @hapic.input_path(UserWorkspaceIdPathSchema())
281 281
     @hapic.input_query(ContentIdsQuerySchema(), as_list=['contents_ids'])
@@ -310,7 +310,7 @@ class UserController(Controller):
310 310
             for content in last_actives
311 311
         ]
312 312
 
313
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
313
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
314 314
     @require_same_user_or_profile(Group.TIM_ADMIN)
315 315
     @hapic.input_path(UserWorkspaceAndContentIdPathSchema())
316 316
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -327,7 +327,7 @@ class UserController(Controller):
327 327
         api.mark_read(request.current_content, do_flush=True)
328 328
         return
329 329
 
330
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
330
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
331 331
     @require_same_user_or_profile(Group.TIM_ADMIN)
332 332
     @hapic.input_path(UserWorkspaceAndContentIdPathSchema())
333 333
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -344,7 +344,7 @@ class UserController(Controller):
344 344
         api.mark_unread(request.current_content, do_flush=True)
345 345
         return
346 346
 
347
-    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
347
+    @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
348 348
     @require_same_user_or_profile(Group.TIM_ADMIN)
349 349
     @hapic.input_path(UserWorkspaceIdPathSchema())
350 350
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 14 - 14
backend/tracim_backend/views/core_api/workspace_controller.py View File

@@ -49,12 +49,12 @@ from tracim_backend.views.core_api.schemas import WorkspaceMemberSchema
49 49
 from tracim_backend.models.contents import ContentTypeLegacy as ContentType
50 50
 from tracim_backend.models.revision_protection import new_revision
51 51
 
52
-WORKSPACE_ENDPOINTS_TAG = 'Workspaces'
52
+SWAGGER_TAG_WORKSPACE_ENDPOINTS = 'Workspaces'
53 53
 
54 54
 
55 55
 class WorkspaceController(Controller):
56 56
 
57
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
57
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
58 58
     @require_workspace_role(UserRoleInWorkspace.READER)
59 59
     @hapic.input_path(WorkspaceIdPathSchema())
60 60
     @hapic.output_body(WorkspaceSchema())
@@ -70,7 +70,7 @@ class WorkspaceController(Controller):
70 70
         )
71 71
         return wapi.get_workspace_with_context(request.current_workspace)
72 72
 
73
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
73
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
74 74
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
75 75
     @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER)
76 76
     @hapic.input_path(WorkspaceIdPathSchema())
@@ -94,7 +94,7 @@ class WorkspaceController(Controller):
94 94
         )
95 95
         return wapi.get_workspace_with_context(request.current_workspace)
96 96
 
97
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
97
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
98 98
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
99 99
     @require_profile(Group.TIM_MANAGER)
100 100
     @hapic.input_body(WorkspaceCreationSchema())
@@ -116,7 +116,7 @@ class WorkspaceController(Controller):
116 116
         )
117 117
         return wapi.get_workspace_with_context(workspace)
118 118
 
119
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
119
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
120 120
     @require_workspace_role(UserRoleInWorkspace.READER)
121 121
     @hapic.input_path(WorkspaceIdPathSchema())
122 122
     @hapic.output_body(WorkspaceMemberSchema(many=True))
@@ -142,7 +142,7 @@ class WorkspaceController(Controller):
142 142
             for user_role in roles
143 143
         ]
144 144
 
145
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
145
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
146 146
     @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER)
147 147
     @hapic.input_path(WorkspaceAndUserIdPathSchema())
148 148
     @hapic.input_body(RoleUpdateSchema())
@@ -174,7 +174,7 @@ class WorkspaceController(Controller):
174 174
         )
175 175
         return rapi.get_user_role_workspace_with_context(role)
176 176
 
177
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
177
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
178 178
     @hapic.handle_exception(UserCreationFailed, HTTPStatus.BAD_REQUEST)
179 179
     @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER)
180 180
     @hapic.input_path(WorkspaceIdPathSchema())
@@ -232,7 +232,7 @@ class WorkspaceController(Controller):
232 232
             email_sent=email_sent,
233 233
         )
234 234
 
235
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
235
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
236 236
     @require_workspace_role(UserRoleInWorkspace.READER)
237 237
     @hapic.input_path(WorkspaceIdPathSchema())
238 238
     @hapic.input_query(FilterContentQuerySchema())
@@ -266,7 +266,7 @@ class WorkspaceController(Controller):
266 266
         ]
267 267
         return contents
268 268
 
269
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
269
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
270 270
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
271 271
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
272 272
     @hapic.input_path(WorkspaceIdPathSchema())
@@ -306,7 +306,7 @@ class WorkspaceController(Controller):
306 306
         content = api.get_content_in_context(content)
307 307
         return content
308 308
 
309
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
309
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
310 310
     @hapic.handle_exception(WorkspacesDoNotMatch, HTTPStatus.BAD_REQUEST)
311 311
     @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
312 312
     @require_candidate_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
@@ -358,7 +358,7 @@ class WorkspaceController(Controller):
358 358
         )
359 359
         return api.get_content_in_context(updated_content)
360 360
 
361
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
361
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
362 362
     @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
363 363
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
364 364
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -390,7 +390,7 @@ class WorkspaceController(Controller):
390 390
             api.delete(content)
391 391
         return
392 392
 
393
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
393
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
394 394
     @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
395 395
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
396 396
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -423,7 +423,7 @@ class WorkspaceController(Controller):
423 423
             api.undelete(content)
424 424
         return
425 425
 
426
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
426
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
427 427
     @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
428 428
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
429 429
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -452,7 +452,7 @@ class WorkspaceController(Controller):
452 452
             api.archive(content)
453 453
         return
454 454
 
455
-    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
455
+    @hapic.with_api_doc(tags=[SWAGGER_TAG_WORKSPACE_ENDPOINTS])
456 456
     @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
457 457
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
458 458
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8