From 65a8ae0ae7db21027cddbbf7f30eccf5f6a3d484 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 5 Mar 2023 10:30:26 +0100 Subject: [PATCH] API & Client - rename data export endpoints --- fittrackee/tests/users/test_auth_api.py | 26 +++++++++---------- fittrackee/users/auth.py | 12 ++++----- .../ProfileEdition/UserAccountEdition.vue | 2 +- .../src/store/modules/authUser/actions.ts | 4 +-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/fittrackee/tests/users/test_auth_api.py b/fittrackee/tests/users/test_auth_api.py index e0498901..d0976b6f 100644 --- a/fittrackee/tests/users/test_auth_api.py +++ b/fittrackee/tests/users/test_auth_api.py @@ -2845,7 +2845,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) response = client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -2871,7 +2871,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) response = client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -2893,7 +2893,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) response = client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -2919,7 +2919,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) response = client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -2944,7 +2944,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -2974,7 +2974,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3000,7 +3000,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin): ) client.post( - '/api/auth/profile/export/request', + '/api/auth/account/export/request', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3025,7 +3025,7 @@ class TestGetUserDataExportRequest(ApiTestCaseMixin): ) response = client.get( - '/api/auth/profile/export', + '/api/auth/account/export', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3053,7 +3053,7 @@ class TestGetUserDataExportRequest(ApiTestCaseMixin): ) response = client.get( - '/api/auth/profile/export', + '/api/auth/account/export', content_type='application/json', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3075,7 +3075,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin): ) response = client.get( - f'/api/auth/profile/export/{self.random_string()}', + f'/api/auth/account/export/{self.random_string()}', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3095,7 +3095,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin): ) response = client.get( - f'/api/auth/profile/export/{archive_file_name}', + f'/api/auth/account/export/{archive_file_name}', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3114,7 +3114,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin): ) response = client.get( - f'/api/auth/profile/export/{self.random_string()}', + f'/api/auth/account/export/{self.random_string()}', headers=dict(Authorization=f'Bearer {auth_token}'), ) @@ -3136,7 +3136,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin): mock.return_value = 'file' client.get( - f'/api/auth/profile/export/{archive_file_name}', + f'/api/auth/account/export/{archive_file_name}', headers=dict(Authorization=f'Bearer {auth_token}'), ) diff --git a/fittrackee/users/auth.py b/fittrackee/users/auth.py index dbcea914..a9ee7783 100644 --- a/fittrackee/users/auth.py +++ b/fittrackee/users/auth.py @@ -1688,7 +1688,7 @@ def accept_privacy_policy(auth_user: User) -> Union[Dict, HttpResponse]: return handle_error_and_return_response(e, db=db) -@auth_blueprint.route('/auth/profile/export/request', methods=['POST']) +@auth_blueprint.route('/auth/account/export/request', methods=['POST']) @require_auth() def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: """ @@ -1698,7 +1698,7 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: .. sourcecode:: http - POST /auth/profile/export/request HTTP/1.1 + POST /auth/account/export/request HTTP/1.1 Content-Type: application/json **Example response**: @@ -1761,7 +1761,7 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: return handle_error_and_return_response(e, db=db) -@auth_blueprint.route('/auth/profile/export', methods=['GET']) +@auth_blueprint.route('/auth/account/export', methods=['GET']) @require_auth() def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: """ @@ -1777,7 +1777,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: .. sourcecode:: http - GET /auth/profile/export HTTP/1.1 + GET /auth/account/export HTTP/1.1 Content-Type: application/json **Example response**: @@ -1829,7 +1829,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]: @auth_blueprint.route( - '/auth/profile/export/', methods=['GET'] + '/auth/account/export/', methods=['GET'] ) @require_auth() def download_data_export( @@ -1842,7 +1842,7 @@ def download_data_export( .. sourcecode:: http - GET /auth/profile/export/download/archive_rgjsR3fHr5Yp.zip HTTP/1.1 + GET /auth/account/export/download/archive_rgjsR3fHr5Yp.zip HTTP/1.1 Content-Type: application/json **Example response**: diff --git a/fittrackee_client/src/components/User/ProfileEdition/UserAccountEdition.vue b/fittrackee_client/src/components/User/ProfileEdition/UserAccountEdition.vue index 3b82739e..9662ba37 100644 --- a/fittrackee_client/src/components/User/ProfileEdition/UserAccountEdition.vue +++ b/fittrackee_client/src/components/User/ProfileEdition/UserAccountEdition.vue @@ -212,7 +212,7 @@ async function downloadArchive(filename: string) { generatingLink.value = true await authApi - .get(`/auth/profile/export/${filename}`, { + .get(`/auth/account/export/${filename}`, { responseType: 'blob', }) .then((response) => { diff --git a/fittrackee_client/src/store/modules/authUser/actions.ts b/fittrackee_client/src/store/modules/authUser/actions.ts index 4ec765bf..a90ae4df 100644 --- a/fittrackee_client/src/store/modules/authUser/actions.ts +++ b/fittrackee_client/src/store/modules/authUser/actions.ts @@ -452,7 +452,7 @@ export const actions: ActionTree & ): void { context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) authApi - .post('auth/profile/export/request') + .post('auth/account/export/request') .then((res) => { if (res.data.status === 'success') { context.commit( @@ -470,7 +470,7 @@ export const actions: ActionTree & ): void { context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) authApi - .get('auth/profile/export') + .get('auth/account/export') .then((res) => { if (res.data.status === 'success') { context.commit(