From 4af0c0b2ae834c21c9954bd548712ce89f3af065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=A9na=C3=ABl=20Muller?= Date: Fri, 27 Jul 2018 09:58:40 +0200 Subject: [PATCH] rename endpoints swagger tags constants --- .../views/contents_api/comment_controller.py | 8 ++--- tracim/views/contents_api/file_controller.py | 30 +++++++++---------- .../contents_api/html_document_controller.py | 10 +++---- .../views/contents_api/threads_controller.py | 10 +++---- tracim/views/core_api/session_controller.py | 8 ++--- tracim/views/core_api/system_controller.py | 6 ++-- tracim/views/core_api/user_controller.py | 30 +++++++++---------- tracim/views/core_api/workspace_controller.py | 28 ++++++++--------- 8 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tracim/views/contents_api/comment_controller.py b/tracim/views/contents_api/comment_controller.py index 6c57f5e..f1736d0 100644 --- a/tracim/views/contents_api/comment_controller.py +++ b/tracim/views/contents_api/comment_controller.py @@ -24,12 +24,12 @@ from tracim.models.revision_protection import new_revision from tracim.models.data import UserRoleInWorkspace -COMMENT_ENDPOINTS_TAG = 'Comments' +SWAGGER_TAG__COMMENT_ENDPOINTS = 'Comments' class CommentController(Controller): - @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(CommentSchema(many=True)) @@ -55,7 +55,7 @@ def content_comments(self, context, request: TracimRequest, hapic_data=None): for comment in comments ] - @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS]) @hapic.handle_exception(EmptyCommentContentNotAllowed, HTTPStatus.BAD_REQUEST) # nopep8 @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -84,7 +84,7 @@ def add_comment(self, context, request: TracimRequest, hapic_data=None): ) return api.get_content_in_context(comment) - @hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__COMMENT_ENDPOINTS]) @require_comment_ownership_or_role( minimal_required_role_for_anyone=UserRoleInWorkspace.WORKSPACE_MANAGER, minimal_required_role_for_owner=UserRoleInWorkspace.CONTRIBUTOR, diff --git a/tracim/views/contents_api/file_controller.py b/tracim/views/contents_api/file_controller.py index 68f32ab..d2e6b14 100644 --- a/tracim/views/contents_api/file_controller.py +++ b/tracim/views/contents_api/file_controller.py @@ -39,7 +39,7 @@ from tracim.exceptions import PageOfPreviewNotFound from tracim.exceptions import PreviewDimNotAllowed -FILE_ENDPOINTS_TAG = 'Files' +SWAGGER_TAG__FILE_ENDPOINTS = 'Files' class FileController(Controller): @@ -48,7 +48,7 @@ class FileController(Controller): """ # File data - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -84,7 +84,7 @@ def upload_file(self, context, request: TracimRequest, hapic_data=None): return - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -109,7 +109,7 @@ def download_file(self, context, request: TracimRequest, hapic_data=None): response.app_iter = FileIter(file) return response - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentRevisionIdPathSchema()) @@ -140,7 +140,7 @@ def download_revisions_file(self, context, request: TracimRequest, hapic_data=No # preview # pdf - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST) @@ -169,7 +169,7 @@ def preview_pdf(self, context, request: TracimRequest, hapic_data=None): ) return FileResponse(pdf_preview_path) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST) @@ -192,7 +192,7 @@ def preview_pdf_full(self, context, request: TracimRequest, hapic_data=None): # pdf_preview_path = api.get_full_pdf_preview_path(content.revision_id) return FileResponse(pdf_preview_path) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST) @@ -225,7 +225,7 @@ def preview_pdf_revision(self, context, request: TracimRequest, hapic_data=None) return FileResponse(pdf_preview_path) # jpg - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST) @@ -256,7 +256,7 @@ def preview_jpg(self, context, request: TracimRequest, hapic_data=None): ) return FileResponse(jpg_preview_path) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST) @@ -287,7 +287,7 @@ def sized_preview_jpg(self, context, request: TracimRequest, hapic_data=None): ) return FileResponse(jpg_preview_path) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST) @@ -322,7 +322,7 @@ def sized_preview_jpg_revision(self, context, request: TracimRequest, hapic_data ) return FileResponse(jpg_preview_path) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -341,7 +341,7 @@ def allowed_dim_preview_jpg(self, context, request: TracimRequest, hapic_data=No return api.get_jpg_preview_allowed_dim() # File infos - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -362,7 +362,7 @@ def get_file_infos(self, context, request: TracimRequest, hapic_data=None) -> Co ) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([file_type]) @@ -397,7 +397,7 @@ def update_file_info(self, context, request: TracimRequest, hapic_data=None) -> api.save(content) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([file_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -427,7 +427,7 @@ def get_file_revisions( for revision in revisions ] - @hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([file_type]) diff --git a/tracim/views/contents_api/html_document_controller.py b/tracim/views/contents_api/html_document_controller.py index 3a86060..e0f317c 100644 --- a/tracim/views/contents_api/html_document_controller.py +++ b/tracim/views/contents_api/html_document_controller.py @@ -30,12 +30,12 @@ from tracim.models.contents import html_documents_type from tracim.models.revision_protection import new_revision -HTML_DOCUMENT_ENDPOINTS_TAG = 'HTML documents' +SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS = 'HTML documents' class HTMLDocumentController(Controller): - @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([html_documents_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -56,7 +56,7 @@ def get_html_document(self, context, request: TracimRequest, hapic_data=None) -> ) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([html_documents_type]) @@ -91,7 +91,7 @@ def update_html_document(self, context, request: TracimRequest, hapic_data=None) api.save(content) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([html_documents_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -121,7 +121,7 @@ def get_html_document_revisions( for revision in revisions ] - @hapic.with_api_doc(tags=[HTML_DOCUMENT_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([html_documents_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) diff --git a/tracim/views/contents_api/threads_controller.py b/tracim/views/contents_api/threads_controller.py index 8c33615..e376d62 100644 --- a/tracim/views/contents_api/threads_controller.py +++ b/tracim/views/contents_api/threads_controller.py @@ -29,12 +29,12 @@ from tracim.models.contents import thread_type from tracim.models.revision_protection import new_revision -THREAD_ENDPOINTS_TAG = 'Threads' +SWAGGER_TAG__THREAD_ENDPOINTS = 'Threads' class ThreadController(Controller): - @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([thread_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -55,7 +55,7 @@ def get_thread(self, context, request: TracimRequest, hapic_data=None) -> Conten ) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([thread_type]) @@ -90,7 +90,7 @@ def update_thread(self, context, request: TracimRequest, hapic_data=None) -> Con api.save(content) return api.get_content_in_context(content) - @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @require_content_types([thread_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @@ -120,7 +120,7 @@ def get_thread_revisions( for revision in revisions ] - @hapic.with_api_doc(tags=[THREAD_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @require_content_types([thread_type]) @hapic.input_path(WorkspaceAndContentIdPathSchema()) diff --git a/tracim/views/core_api/session_controller.py b/tracim/views/core_api/session_controller.py index f1a27ad..0969ef4 100644 --- a/tracim/views/core_api/session_controller.py +++ b/tracim/views/core_api/session_controller.py @@ -16,12 +16,12 @@ from tracim.exceptions import NotAuthenticated from tracim.exceptions import AuthenticationFailed -SESSION_ENDPOINTS_TAG = 'Session' +SWAGGER_TAG__SESSION_ENDPOINTS_TAG = 'Session' class SessionController(Controller): - @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS_TAG]) @hapic.input_headers(LoginOutputHeaders()) @hapic.input_body(BasicAuthSchema()) # TODO - G.M - 17-04-2018 - fix output header ? @@ -42,7 +42,7 @@ def login(self, context, request: TracimRequest, hapic_data=None): user = uapi.authenticate_user(login.email, login.password) return uapi.get_user_with_context(user) - @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS_TAG]) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 def logout(self, context, request: TracimRequest, hapic_data=None): """ @@ -51,7 +51,7 @@ def logout(self, context, request: TracimRequest, hapic_data=None): return - @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__SESSION_ENDPOINTS_TAG]) @hapic.output_body(UserSchema(),) def whoami(self, context, request: TracimRequest, hapic_data=None): """ diff --git a/tracim/views/core_api/system_controller.py b/tracim/views/core_api/system_controller.py index ff6bc40..9cfefac 100644 --- a/tracim/views/core_api/system_controller.py +++ b/tracim/views/core_api/system_controller.py @@ -18,12 +18,12 @@ from tracim.views.core_api.schemas import ApplicationSchema from tracim.views.core_api.schemas import ContentTypeSchema -SYSTEM_ENDPOINTS_TAG = 'System' +SWAGGER_TAG__SYSTEM_ENDPOINTS = 'System' class SystemController(Controller): - @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__SYSTEM_ENDPOINTS]) @require_profile(Group.TIM_USER) @hapic.output_body(ApplicationSchema(many=True),) def applications(self, context, request: TracimRequest, hapic_data=None): @@ -32,7 +32,7 @@ def applications(self, context, request: TracimRequest, hapic_data=None): """ return applications - @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__SYSTEM_ENDPOINTS]) @require_profile(Group.TIM_USER) @hapic.output_body(ContentTypeSchema(many=True),) def content_types(self, context, request: TracimRequest, hapic_data=None): diff --git a/tracim/views/core_api/user_controller.py b/tracim/views/core_api/user_controller.py index dc10193..eddb09f 100644 --- a/tracim/views/core_api/user_controller.py +++ b/tracim/views/core_api/user_controller.py @@ -32,12 +32,12 @@ from tracim.views.core_api.schemas import ActiveContentFilterQuerySchema from tracim.views.core_api.schemas import WorkspaceDigestSchema -USER_ENDPOINTS_TAG = 'Users' +SWAGGER_TAG__USER_ENDPOINTS = 'Users' class UserController(Controller): - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.output_body(WorkspaceDigestSchema(many=True),) @@ -58,7 +58,7 @@ def user_workspace(self, context, request: TracimRequest, hapic_data=None): for workspace in workspaces ] - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.output_body(UserSchema()) @@ -74,7 +74,7 @@ def user(self, context, request: TracimRequest, hapic_data=None): ) return uapi.get_user_with_context(request.candidate_user) - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @hapic.handle_exception(WrongUserPassword, HTTPStatus.FORBIDDEN) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_body(SetEmailSchema()) @@ -98,7 +98,7 @@ def set_user_email(self, context, request: TracimRequest, hapic_data=None): ) return uapi.get_user_with_context(user) - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @hapic.handle_exception(WrongUserPassword, HTTPStatus.FORBIDDEN) @hapic.handle_exception(PasswordDoNotMatch, HTTPStatus.BAD_REQUEST) @require_same_user_or_profile(Group.TIM_ADMIN) @@ -124,7 +124,7 @@ def set_user_password(self, context, request: TracimRequest, hapic_data=None): ) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_body(UserInfosSchema()) @hapic.input_path(UserIdPathSchema()) @@ -147,7 +147,7 @@ def set_user_infos(self, context, request: TracimRequest, hapic_data=None): ) return uapi.get_user_with_context(user) - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.input_body(UserCreationSchema()) @@ -179,7 +179,7 @@ def create_user(self, context, request: TracimRequest, hapic_data=None): ) return uapi.get_user_with_context(user) - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -196,7 +196,7 @@ def enable_user(self, context, request: TracimRequest, hapic_data=None): uapi.enable(user=request.candidate_user, do_save=True) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -213,7 +213,7 @@ def disable_user(self, context, request: TracimRequest, hapic_data=None): uapi.disable(user=request.candidate_user, do_save=True) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_profile(Group.TIM_ADMIN) @hapic.input_path(UserIdPathSchema()) @hapic.input_body(UserProfileSchema()) @@ -241,7 +241,7 @@ def set_profile(self, context, request: TracimRequest, hapic_data=None): ) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserWorkspaceIdPathSchema()) @hapic.input_query(ActiveContentFilterQuerySchema()) @@ -275,7 +275,7 @@ def last_active_content(self, context, request: TracimRequest, hapic_data=None): for content in last_actives ] - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserWorkspaceIdPathSchema()) @hapic.input_query(ContentIdsQuerySchema(), as_list=['contents_ids']) @@ -310,7 +310,7 @@ def contents_read_status(self, context, request: TracimRequest, hapic_data=None) for content in last_actives ] - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserWorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -327,7 +327,7 @@ def set_content_as_read(self, context, request: TracimRequest, hapic_data=None): api.mark_read(request.current_content, do_flush=True) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserWorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -344,7 +344,7 @@ def set_content_as_unread(self, context, request: TracimRequest, hapic_data=None api.mark_unread(request.current_content, do_flush=True) return - @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS]) @require_same_user_or_profile(Group.TIM_ADMIN) @hapic.input_path(UserWorkspaceIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 diff --git a/tracim/views/core_api/workspace_controller.py b/tracim/views/core_api/workspace_controller.py index f475c36..71a1661 100644 --- a/tracim/views/core_api/workspace_controller.py +++ b/tracim/views/core_api/workspace_controller.py @@ -49,12 +49,12 @@ from tracim.models.contents import ContentTypeLegacy as ContentType from tracim.models.revision_protection import new_revision -WORKSPACE_ENDPOINTS_TAG = 'Workspaces' +SWAGGER_TAG__WORKSPACE_ENDPOINTS = 'Workspaces' class WorkspaceController(Controller): - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @hapic.input_path(WorkspaceIdPathSchema()) @hapic.output_body(WorkspaceSchema()) @@ -70,7 +70,7 @@ def workspace(self, context, request: TracimRequest, hapic_data=None): ) return wapi.get_workspace_with_context(request.current_workspace) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER) @hapic.input_path(WorkspaceIdPathSchema()) @@ -94,7 +94,7 @@ def update_workspace(self, context, request: TracimRequest, hapic_data=None): # ) return wapi.get_workspace_with_context(request.current_workspace) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @require_profile(Group.TIM_MANAGER) @hapic.input_body(WorkspaceCreationSchema()) @@ -116,7 +116,7 @@ def create_workspace(self, context, request: TracimRequest, hapic_data=None): # ) return wapi.get_workspace_with_context(workspace) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @hapic.input_path(WorkspaceIdPathSchema()) @hapic.output_body(WorkspaceMemberSchema(many=True)) @@ -142,7 +142,7 @@ def workspaces_members( for user_role in roles ] - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER) @hapic.input_path(WorkspaceAndUserIdPathSchema()) @hapic.input_body(RoleUpdateSchema()) @@ -174,7 +174,7 @@ def update_workspaces_members_role( ) return rapi.get_user_role_workspace_with_context(role) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @hapic.handle_exception(UserCreationFailed, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.WORKSPACE_MANAGER) @hapic.input_path(WorkspaceIdPathSchema()) @@ -232,7 +232,7 @@ def create_workspaces_members_role( email_sent=email_sent, ) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.READER) @hapic.input_path(WorkspaceIdPathSchema()) @hapic.input_query(FilterContentQuerySchema()) @@ -266,7 +266,7 @@ def workspace_content( ] return contents - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR) @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST) @hapic.input_path(WorkspaceIdPathSchema()) @@ -306,7 +306,7 @@ def create_generic_empty_content( content = api.get_content_in_context(content) return content - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @hapic.handle_exception(WorkspacesDoNotMatch, HTTPStatus.BAD_REQUEST) @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @require_candidate_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @@ -358,7 +358,7 @@ def move_content( ) return api.get_content_in_context(updated_content) - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -390,7 +390,7 @@ def delete_content( api.delete(content) return - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -423,7 +423,7 @@ def undelete_content( api.undelete(content) return - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8 @@ -452,7 +452,7 @@ def archive_content( api.archive(content) return - @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG]) + @hapic.with_api_doc(tags=[SWAGGER_TAG__WORKSPACE_ENDPOINTS]) @require_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER) @hapic.input_path(WorkspaceAndContentIdPathSchema()) @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8