From 5e12663d771ed95e299bd94879ff353804764268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Sun, 12 May 2024 21:45:26 +0200 Subject: [PATCH 01/11] compulsory update alert --- src/utils/checkForUpdates.ts | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/utils/checkForUpdates.ts b/src/utils/checkForUpdates.ts index 3b97bf42..8e29c4c2 100644 --- a/src/utils/checkForUpdates.ts +++ b/src/utils/checkForUpdates.ts @@ -24,22 +24,21 @@ export const checkForUpdates = async (shouldReload?: boolean) => { if (isAlertOpened) return isAlertOpened = true - alert(i18n.t('update.alert_title'), i18n.t('update.alert_message'), [ - { - text: i18n.t('common.cancel'), - onPress: () => { - isAlertOpened = false + alert( + i18n.t('update.alert_title'), + i18n.t('update.alert_message'), + [ + { + text: i18n.t('update.restart'), + onPress: async () => { + isAlertOpened = false + await Updates.reloadAsync() + }, }, - style: 'cancel', - }, - { - text: i18n.t('update.restart'), - onPress: async () => { - await Updates.reloadAsync() - }, - }, - ]) + ], + { cancelable: false } + ) } catch (e) { - console.log('There was some error while checking updates', e) + console.error('There was some error while checking updates', e) } } From fcd942c0cc6f6f8b1476304eddd46c99436eced5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 13 May 2024 12:34:27 +0200 Subject: [PATCH 02/11] forcing user to update --- scripts/data/swagger-spec.json | 1268 ++++++++++++++++++---- src/api/query/system/system.msw.ts | 35 +- src/api/query/system/system.ts | 18 +- src/api/types/appVersionStatusEntity.ts | 21 + src/api/types/index.ts | 1 + src/i18n/translations/en.json | 7 +- src/i18n/translations/pl.json | 6 +- src/screens/DataFromBeScreen_EXAMPLE.tsx | 41 +- src/utils/checkForUpdates.ts | 29 +- 9 files changed, 1174 insertions(+), 252 deletions(-) create mode 100644 src/api/types/appVersionStatusEntity.ts diff --git a/scripts/data/swagger-spec.json b/scripts/data/swagger-spec.json index 65e6554c..f9cef501 100644 --- a/scripts/data/swagger-spec.json +++ b/scripts/data/swagger-spec.json @@ -10,28 +10,42 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CreateArticleDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateArticleDto" + } + } } }, "responses": { "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ArticleEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArticleEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -42,8 +56,22 @@ "summary": "Find All Articles", "description": "Retrieves a list of all articles with pagination support.", "parameters": [ - { "name": "page", "required": true, "in": "query", "schema": { "type": "number" } }, - { "name": "pageSize", "required": true, "in": "query", "schema": { "type": "number" } } + { + "name": "page", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + }, + { + "name": "pageSize", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + } ], "responses": { "200": { @@ -52,7 +80,9 @@ "application/json": { "schema": { "type": "array", - "items": { "$ref": "#/components/schemas/ArticleEntity" } + "items": { + "$ref": "#/components/schemas/ArticleEntity" + } } } } @@ -60,7 +90,11 @@ "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -73,8 +107,22 @@ "summary": "Find Draft Articles", "description": "Retrieves a list of draft articles with pagination support.", "parameters": [ - { "name": "page", "required": true, "in": "query", "schema": { "type": "number" } }, - { "name": "pageSize", "required": true, "in": "query", "schema": { "type": "number" } } + { + "name": "page", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + }, + { + "name": "pageSize", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + } ], "responses": { "200": { @@ -83,7 +131,9 @@ "application/json": { "schema": { "type": "array", - "items": { "$ref": "#/components/schemas/ArticleEntity" } + "items": { + "$ref": "#/components/schemas/ArticleEntity" + } } } } @@ -91,7 +141,11 @@ "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -104,19 +158,34 @@ "summary": "Find Article by ID", "description": "Retrieves an article by its unique identifier.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "number" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } ], "responses": { "200": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ArticleEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArticleEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -127,33 +196,54 @@ "summary": "Update Article", "description": "Updates an article with the provided details.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "number" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } ], "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UpdateArticleDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateArticleDto" + } + } } }, "responses": { "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ArticleEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArticleEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -164,14 +254,27 @@ "summary": "Remove Article", "description": "Deletes an article by its unique identifier.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "number" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } ], "responses": { - "204": { "description": "" }, + "204": { + "description": "" + }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -187,55 +290,93 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CreateUserDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserDto" + } + } } }, "responses": { "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Forbidden", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["users"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "get": { "operationId": "UsersController_findAll", "summary": "Find All Users", "description": "Retrieves a list of all users.", "parameters": [ - { "name": "page", "required": true, "in": "query", "schema": { "type": "number" } }, - { "name": "pageSize", "required": true, "in": "query", "schema": { "type": "number" } } + { + "name": "page", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + }, + { + "name": "pageSize", + "required": true, + "in": "query", + "schema": { + "type": "number" + } + } ], "responses": { "200": { @@ -244,7 +385,9 @@ "application/json": { "schema": { "type": "array", - "items": { "$ref": "#/components/schemas/UserEntity" } + "items": { + "$ref": "#/components/schemas/UserEntity" + } } } } @@ -253,25 +396,39 @@ "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Forbidden", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["users"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/users/{id}": { @@ -280,120 +437,199 @@ "summary": "Find User by ID", "description": "Retrieves a user by its ID.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "string" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } ], "responses": { "200": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Forbidden", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["users"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "patch": { "operationId": "UsersController_update", "summary": "Update User", "description": "Updates a user with the provided details.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "string" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } ], "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUserDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateUserDto" + } + } } }, "responses": { "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Forbidden", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["users"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "delete": { "operationId": "UsersController_remove", "summary": "Remove User", "description": "Deletes a user by their unique identifier.", "parameters": [ - { "name": "id", "required": true, "in": "path", "schema": { "type": "string" } } + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } ], "responses": { "200": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Forbidden", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["users"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/email/login": { @@ -405,35 +641,51 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEmailLoginDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEmailLoginDto" + } + } } }, "responses": { "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "403": { "description": "Please activate your account before proceeding", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -441,14 +693,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -466,14 +724,18 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthRegisterLoginDto" } + "schema": { + "$ref": "#/components/schemas/AuthRegisterLoginDto" + } } } }, @@ -481,15 +743,23 @@ "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, - "400": { "description": "Bad Request - Missing or invalid registration details" }, + "400": { + "description": "Bad Request - Missing or invalid registration details" + }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -497,14 +767,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -522,22 +798,32 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthConfirmEmailDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthConfirmEmailDto" + } + } } }, "responses": { - "400": { "description": "Bad Request - Invalid or expired hash code" }, + "400": { + "description": "Bad Request - Invalid or expired hash code" + }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -545,14 +831,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -570,14 +862,18 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthResendVerificationEmailDto" } + "schema": { + "$ref": "#/components/schemas/AuthResendVerificationEmailDto" + } } } }, @@ -585,14 +881,20 @@ "400": { "description": "Bad Request - Invalid email format", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -600,14 +902,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -625,14 +933,18 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthForgotPasswordDto" } + "schema": { + "$ref": "#/components/schemas/AuthForgotPasswordDto" + } } } }, @@ -640,14 +952,20 @@ "400": { "description": "Bad Request - Invalid email format", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -655,14 +973,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -679,7 +1003,9 @@ "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthResetPasswordDto" } + "schema": { + "$ref": "#/components/schemas/AuthResetPasswordDto" + } } } }, @@ -687,14 +1013,20 @@ "400": { "description": "Bad Request - Invalid or expired hash code", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -702,14 +1034,20 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -727,27 +1065,39 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEmailChangeDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEmailChangeDto" + } + } } }, "responses": { "400": { "description": "Bad Request - Invalid or expired hash code", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Validation Error - One or more fields did not pass validation", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorValidationEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } } } }, @@ -755,19 +1105,29 @@ "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/email/change-confirm": { @@ -781,14 +1141,18 @@ "in": "header", "description": "Specifies the preferred language for API responses. Supported values are: en (English), de (German), pl (Polish)", "required": false, - "schema": { "type": "string" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthConfirmEmailChangeDto" } + "schema": { + "$ref": "#/components/schemas/AuthConfirmEmailChangeDto" + } } } }, @@ -796,26 +1160,40 @@ "400": { "description": "Bad Request - Invalid or expired hash code", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "429": { "description": "ThrottlerException: Too Many Requests", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/me": { @@ -828,26 +1206,40 @@ "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/UserEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "patch": { "operationId": "AuthController_update", @@ -857,7 +1249,11 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthUpdateDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthUpdateDto" + } + } } }, "responses": { @@ -865,26 +1261,42 @@ "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, - "404": { "description": "User not found" }, + "404": { + "description": "User not found" + }, "422": { "description": "Missing old password / Incorrect old password / Missing password", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "delete": { "operationId": "AuthController_delete", @@ -896,19 +1308,29 @@ "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/refresh": { @@ -921,26 +1343,40 @@ "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/RefreshEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/RefreshEntity" + } + } } }, "401": { "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/logout": { @@ -954,19 +1390,29 @@ "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/logout/all": { @@ -980,19 +1426,29 @@ "description": "Unauthorized", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorUnauthorizedEntity" } + "schema": { + "$ref": "#/components/schemas/ErrorUnauthorizedEntity" + } } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, "tags": ["auth"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/files/upload": { @@ -1008,8 +1464,13 @@ "schema": { "type": "object", "properties": { - "file": { "type": "string", "format": "binary" }, - "category": { "type": "string" } + "file": { + "type": "string", + "format": "binary" + }, + "category": { + "type": "string" + } } } } @@ -1019,14 +1480,26 @@ "201": { "description": "", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/FileEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileEntity" + } + } } }, - "422": { "description": "Unprocessable Entity - No file selected or missing user ID." }, - "500": { "description": "Internal server error" } + "422": { + "description": "Unprocessable Entity - No file selected or missing user ID." + }, + "500": { + "description": "Internal server error" + } }, "tags": ["files"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/files/{fileName}": { @@ -1035,32 +1508,58 @@ "summary": "Download File", "description": "Downloads the specified file.", "parameters": [ - { "name": "fileName", "required": true, "in": "path", "schema": { "type": "string" } } + { + "name": "fileName", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } ], "responses": { "403": { "description": "Forbidden - You do not have permission to view this file or file does not exist." }, - "500": { "description": "Internal server error" } + "500": { + "description": "Internal server error" + } }, "tags": ["files"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] }, "delete": { "operationId": "FilesController_deleteFile", "summary": "Delete File", "description": "Deletes the specified file.", "parameters": [ - { "name": "fileName", "required": true, "in": "path", "schema": { "type": "string" } } + { + "name": "fileName", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } ], "responses": { "403": { "description": "Forbidden - You do not have permission to delete this file or file does not exist." }, - "500": { "description": "Internal server error" } + "500": { + "description": "Internal server error" + } }, "tags": ["files"], - "security": [{ "bearer": [] }] + "security": [ + { + "bearer": [] + } + ] } }, "/api/v1/auth/google/login": { @@ -1072,32 +1571,52 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthGoogleLoginDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthGoogleLoginDto" + } + } } }, "responses": { "201": { "description": "Successfully logged in with Google", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEntity" + } + } } }, "400": { "description": "Bad Request - Error during Google token verification or processing", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Unprocessable Entity - Invalid or expired Google token", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -1114,7 +1633,9 @@ "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AuthFacebookLoginDto" } + "schema": { + "$ref": "#/components/schemas/AuthFacebookLoginDto" + } } } }, @@ -1122,25 +1643,41 @@ "201": { "description": "Successfully logged in with Facebook", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEntity" + } + } } }, "400": { "description": "Bad Request - Error during Facebook token verification or processing", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Unprocessable Entity - Invalid or expired Facebook token", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -1156,32 +1693,52 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthAppleLoginDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthAppleLoginDto" + } + } } }, "responses": { "201": { "description": "Successfully logged in with Apple", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/AuthEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthEntity" + } + } } }, "400": { "description": "Bad Request - Error during Apple token verification or processing", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "422": { "description": "Unprocessable Entity - Invalid or expired Apple token", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorServerEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } } } }, @@ -1198,16 +1755,26 @@ "200": { "description": "The health check result.", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/HealthEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/HealthEntity" + } + } } }, "500": { "description": "Internal server error", "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEntity" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorEntity" + } + } } }, - "503": { "description": "One or more health checks failed" } + "503": { + "description": "One or more health checks failed" + } }, "tags": ["health"] } @@ -1219,10 +1786,58 @@ "requestBody": { "required": true, "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CheckUpdateDto" } } + "application/json": { + "schema": { + "$ref": "#/components/schemas/CheckUpdateDto" + } + } + } + }, + "responses": { + "201": { + "description": "Details about application from AppStore or PlayStore based on provided os", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppVersionStatusEntity" + } + } + } + }, + "400": { + "description": "Bad Request - Missing or invalid app details" + }, + "422": { + "description": "Validation Error - One or more fields did not pass validation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorValidationEntity" + } + } + } + }, + "429": { + "description": "ThrottlerException: Too Many Requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorTooManyRequestsEntity" + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorServerEntity" + } + } + } } }, - "responses": { "201": { "description": "" } }, "tags": ["system"] } } @@ -1240,12 +1855,22 @@ "tags": [], "servers": [], "components": { - "securitySchemes": { "bearer": { "scheme": "bearer", "bearerFormat": "JWT", "type": "http" } }, + "securitySchemes": { + "bearer": { + "scheme": "bearer", + "bearerFormat": "JWT", + "type": "http" + } + }, "schemas": { "ErrorServerEntity": { "type": "object", "properties": { - "error": { "type": "string", "description": "Type of error", "example": "Server Error" }, + "error": { + "type": "string", + "description": "Type of error", + "example": "Server Error" + }, "statusCode": { "type": "number", "description": "HTTP status code indicating the error", @@ -1257,35 +1882,75 @@ "CreateArticleDto": { "type": "object", "properties": { - "title": { "type": "string" }, - "description": { "type": "string" }, - "body": { "type": "string" }, - "published": { "type": "boolean", "default": false } + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "body": { + "type": "string" + }, + "published": { + "type": "boolean", + "default": false + } }, "required": ["title", "body"] }, "AuthorPublicDto": { "type": "object", "properties": { - "email": { "type": "string" }, - "firstName": { "type": "string" }, - "lastName": { "type": "string" } + "email": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + } }, "required": ["email", "firstName", "lastName"] }, "ArticleEntity": { "type": "object", "properties": { - "id": { "type": "number" }, - "title": { "type": "string" }, - "description": { "type": "string", "nullable": true }, - "body": { "type": "string" }, - "published": { "type": "boolean" }, - "createdAt": { "format": "date-time", "type": "string" }, - "updatedAt": { "format": "date-time", "type": "string" }, - "deletedAt": { "format": "date-time", "type": "string" }, - "authorId": { "type": "string", "nullable": true }, - "author": { "$ref": "#/components/schemas/AuthorPublicDto" } + "id": { + "type": "number" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string" + }, + "published": { + "type": "boolean" + }, + "createdAt": { + "format": "date-time", + "type": "string" + }, + "updatedAt": { + "format": "date-time", + "type": "string" + }, + "deletedAt": { + "format": "date-time", + "type": "string" + }, + "authorId": { + "type": "string", + "nullable": true + }, + "author": { + "$ref": "#/components/schemas/AuthorPublicDto" + } }, "required": [ "id", @@ -1309,8 +1974,12 @@ "errors": { "type": "object", "description": "Object containing field-specific validation errors", - "example": { "email": "Invalid email format." }, - "additionalProperties": { "type": "string" } + "example": { + "email": "Invalid email format." + }, + "additionalProperties": { + "type": "string" + } } }, "required": ["statusCode", "errors"] @@ -1318,16 +1987,29 @@ "UpdateArticleDto": { "type": "object", "properties": { - "title": { "type": "string" }, - "description": { "type": "string" }, - "body": { "type": "string" }, - "published": { "type": "boolean", "default": false } + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "body": { + "type": "string" + }, + "published": { + "type": "boolean", + "default": false + } } }, "ErrorUnauthorizedEntity": { "type": "object", "properties": { - "error": { "type": "string", "description": "Type of error", "example": "Unauthorized" }, + "error": { + "type": "string", + "description": "Type of error", + "example": "Unauthorized" + }, "statusCode": { "type": "number", "description": "HTTP status code indicating the error", @@ -1344,7 +2026,11 @@ "description": "Message describing the error", "example": "An error occurred while processing your request" }, - "error": { "type": "string", "description": "Type of error", "example": "Forbidden" }, + "error": { + "type": "string", + "description": "Type of error", + "example": "Forbidden" + }, "statusCode": { "type": "number", "description": "HTTP status code indicating the error", @@ -1405,11 +2091,19 @@ }, "role": { "description": "The role assigned to the user.", - "allOf": [{ "$ref": "#/components/schemas/RoleDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/RoleDto" + } + ] }, "status": { "description": "The status of the user account.", - "allOf": [{ "$ref": "#/components/schemas/StatusDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/StatusDto" + } + ] } }, "required": ["email", "password", "firstName", "lastName", "locale", "role", "status"] @@ -1496,7 +2190,10 @@ "UserEntity": { "type": "object", "properties": { - "id": { "type": "string", "example": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8" }, + "id": { + "type": "string", + "example": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8" + }, "createdAt": { "format": "date-time", "type": "string", @@ -1507,22 +2204,60 @@ "type": "string", "example": "2022-02-01T00:00:00.000Z" }, - "deletedAt": { "format": "date-time", "type": "string", "example": null }, - "email": { "type": "string", "example": "user@example.com" }, - "firstName": { "type": "string", "example": "John" }, - "lastName": { "type": "string", "example": "Doe" }, - "provider": { "type": "string", "example": "google" }, - "socialId": { "type": "string", "example": "102209777480561953757" }, - "locale": { "type": "string", "example": "en-US" }, + "deletedAt": { + "format": "date-time", + "type": "string", + "example": null + }, + "email": { + "type": "string", + "example": "user@example.com" + }, + "firstName": { + "type": "string", + "example": "John" + }, + "lastName": { + "type": "string", + "example": "Doe" + }, + "provider": { + "type": "string", + "example": "google" + }, + "socialId": { + "type": "string", + "example": "102209777480561953757" + }, + "locale": { + "type": "string", + "example": "en-US" + }, "role": { - "example": { "id": 2, "name": "USER" }, - "allOf": [{ "$ref": "#/components/schemas/Role" }] + "example": { + "id": 2, + "name": "USER" + }, + "allOf": [ + { + "$ref": "#/components/schemas/Role" + } + ] }, "status": { - "example": { "id": 1, "name": "ACTIVE" }, - "allOf": [{ "$ref": "#/components/schemas/Status" }] + "example": { + "id": 1, + "name": "ACTIVE" + }, + "allOf": [ + { + "$ref": "#/components/schemas/Status" + } + ] }, - "consent": { "$ref": "#/components/schemas/LastConsentEntity" } + "consent": { + "$ref": "#/components/schemas/LastConsentEntity" + } }, "required": [ "id", @@ -1569,11 +2304,19 @@ }, "role": { "description": "The updated role assigned to the user.", - "allOf": [{ "$ref": "#/components/schemas/RoleDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/RoleDto" + } + ] }, "status": { "description": "The updated status of the user account.", - "allOf": [{ "$ref": "#/components/schemas/StatusDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/StatusDto" + } + ] }, "provider": { "type": "string", @@ -1622,7 +2365,11 @@ }, "user": { "description": "The user entity associated with the authentication.", - "allOf": [{ "$ref": "#/components/schemas/UserEntity" }] + "allOf": [ + { + "$ref": "#/components/schemas/UserEntity" + } + ] } }, "required": ["accessToken", "refreshToken", "tokenExpires", "user"] @@ -1646,17 +2393,35 @@ "AuthRegisterLoginDto": { "type": "object", "properties": { - "email": { "type": "string", "example": "example@binarapps.com" }, - "password": { "type": "string", "example": "NewSecurePassword123!" }, - "firstName": { "type": "string", "example": "Jon" }, - "lastName": { "type": "string", "example": "Doe" }, + "email": { + "type": "string", + "example": "example@binarapps.com" + }, + "password": { + "type": "string", + "example": "NewSecurePassword123!" + }, + "firstName": { + "type": "string", + "example": "Jon" + }, + "lastName": { + "type": "string", + "example": "Doe" + }, "locale": { "type": "string", "example": "en-US", "description": "IETF language tags (e.g., en-US)." }, - "termsAccepted": { "type": "boolean", "example": true }, - "privacyPolicyAccepted": { "type": "boolean", "example": true } + "termsAccepted": { + "type": "boolean", + "example": true + }, + "privacyPolicyAccepted": { + "type": "boolean", + "example": true + } }, "required": [ "email", @@ -1897,15 +2662,27 @@ "properties": { "db": { "description": "The status of the database connection", - "allOf": [{ "$ref": "#/components/schemas/HealthCheckStatusDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/HealthCheckStatusDto" + } + ] }, "domain": { "description": "The status of the domain", - "allOf": [{ "$ref": "#/components/schemas/HealthCheckStatusDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/HealthCheckStatusDto" + } + ] }, "cache": { "description": "The status of the cache", - "allOf": [{ "$ref": "#/components/schemas/HealthCheckStatusDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/HealthCheckStatusDto" + } + ] } }, "required": ["db", "domain", "cache"] @@ -1913,10 +2690,18 @@ "HealthEntity": { "type": "object", "properties": { - "status": { "type": "string", "description": "Overall health status", "example": "ok" }, + "status": { + "type": "string", + "description": "Overall health status", + "example": "ok" + }, "info": { "description": "Detailed info about each component's health", - "allOf": [{ "$ref": "#/components/schemas/HealthCheckInfoDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/HealthCheckInfoDto" + } + ] }, "error": { "type": "object", @@ -1925,7 +2710,11 @@ }, "details": { "description": "Detailed health check results for each component", - "allOf": [{ "$ref": "#/components/schemas/HealthCheckInfoDto" }] + "allOf": [ + { + "$ref": "#/components/schemas/HealthCheckInfoDto" + } + ] } }, "required": ["status", "info", "error", "details"] @@ -1946,8 +2735,49 @@ } }, "required": ["os", "currentVersion"] + }, + "AppVersionStatusEntity": { + "type": "object", + "properties": { + "latestVersion": { + "type": "string", + "example": "1.5.0", + "description": "The latest version of the app available in the app store." + }, + "minimumVersion": { + "type": "string", + "example": "1.0.0", + "description": "The minimum version of the app that still functions correctly without mandatory updates." + }, + "updateRequired": { + "type": "boolean", + "example": true, + "description": "Indicates whether an update is required to continue using the app." + }, + "appId": { + "type": "string", + "example": "com.example.com", + "description": "AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID)" + }, + "currentVersionReleaseDate": { + "format": "date-time", + "type": "string", + "example": "2.0.0", + "description": "The current version of the app." + } + }, + "required": [ + "latestVersion", + "minimumVersion", + "updateRequired", + "appId", + "currentVersionReleaseDate" + ] } } }, - "externalDocs": { "description": "JSON", "url": "/docs-json" } + "externalDocs": { + "description": "JSON", + "url": "/docs-json" + } } diff --git a/src/api/query/system/system.msw.ts b/src/api/query/system/system.msw.ts index fff0efcc..ccddfb95 100644 --- a/src/api/query/system/system.msw.ts +++ b/src/api/query/system/system.msw.ts @@ -6,17 +6,38 @@ * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. * OpenAPI spec version: 1.0 */ +import { faker } from '@faker-js/faker' import { HttpResponse, delay, http } from 'msw' -export const getSystemControllerCheckForAppUpdateMockHandler = () => { +import type { AppVersionStatusEntity } from '../../types' + +export const getSystemControllerCheckForAppUpdateResponseMock = ( + overrideResponse: any = {} +): AppVersionStatusEntity => ({ + appId: faker.word.sample(), + currentVersionReleaseDate: `${faker.date.past().toISOString().split('.')[0]}Z`, + latestVersion: faker.word.sample(), + minimumVersion: faker.word.sample(), + updateRequired: faker.datatype.boolean(), + ...overrideResponse, +}) + +export const getSystemControllerCheckForAppUpdateMockHandler = ( + overrideResponse?: AppVersionStatusEntity +) => { return http.post('*/api/v1/system/app-updates/check', async () => { await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getSystemControllerCheckForAppUpdateResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) }) } export const getSystemMock = () => [getSystemControllerCheckForAppUpdateMockHandler()] diff --git a/src/api/query/system/system.ts b/src/api/query/system/system.ts index e52669b0..76c5752d 100644 --- a/src/api/query/system/system.ts +++ b/src/api/query/system/system.ts @@ -11,7 +11,13 @@ import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query import { customInstance } from '../../axios/custom-instance' import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { CheckUpdateDto } from '../../types' +import type { + AppVersionStatusEntity, + CheckUpdateDto, + ErrorServerEntity, + ErrorTooManyRequestsEntity, + ErrorValidationEntity, +} from '../../types' type SecondParameter any> = Parameters[1] @@ -19,7 +25,7 @@ export const systemControllerCheckForAppUpdate = ( checkUpdateDto: BodyType, options?: SecondParameter ) => { - return customInstance( + return customInstance( { url: `/api/v1/system/app-updates/check`, method: 'POST', @@ -31,7 +37,7 @@ export const systemControllerCheckForAppUpdate = ( } export const getSystemControllerCheckForAppUpdateMutationOptions = < - TError = ErrorType, + TError = ErrorType, TContext = unknown >(options?: { mutation?: UseMutationOptions< @@ -65,10 +71,12 @@ export type SystemControllerCheckForAppUpdateMutationResult = NonNullable< Awaited> > export type SystemControllerCheckForAppUpdateMutationBody = BodyType -export type SystemControllerCheckForAppUpdateMutationError = ErrorType +export type SystemControllerCheckForAppUpdateMutationError = ErrorType< + void | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> export const useSystemControllerCheckForAppUpdate = < - TError = ErrorType, + TError = ErrorType, TContext = unknown >(options?: { mutation?: UseMutationOptions< diff --git a/src/api/types/appVersionStatusEntity.ts b/src/api/types/appVersionStatusEntity.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 30320c2a..770cb32e 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -7,6 +7,7 @@ * OpenAPI spec version: 1.0 */ +export * from './appVersionStatusEntity' export * from './articleEntity' export * from './articlesControllerFindAllParams' export * from './articlesControllerFindDraftsParams' diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 01ddb9e1..a4411fd2 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -122,9 +122,11 @@ "update": { "alert_message": "You will have to restart the application to have better experiences while using it", "alert_title": "New version available", - "restart": "Restart" + "restart": "Restart", + "update_now": "Update now", + "error_title": "Error", + "error_message": "An error occurred. Please try again later." }, - "application_info_screen": { "navigation_info": "When you will try to go back it will double ask if you really want to leave \n" }, @@ -149,7 +151,6 @@ "tertiary_gray": "Button tertiary gray", "with_icons": "Button with icons" }, - "loader_variants": { "bricks": "Bricks loader", "bubbles": "Bubbles loader", diff --git a/src/i18n/translations/pl.json b/src/i18n/translations/pl.json index 6ae9f1c5..64735374 100644 --- a/src/i18n/translations/pl.json +++ b/src/i18n/translations/pl.json @@ -122,9 +122,11 @@ "update": { "alert_message": "Będziesz musiał zrestartować aplikację, żeby mieć lepsze doświadczenia podczas jej używania", "alert_title": "Aktualizacja", - "restart": "Zrestartuj" + "restart": "Zrestartuj", + "update_now": "Aktualizuj teraz", + "error_title": "Błąd", + "error_message": "Wystąpił błąd. Proszę spróbuj ponownie później." }, - "application_info_screen": { "navigation_info": "Kiedy będziesz próbował cofnąć to zostaniesz podwójnie zapytany, czy na pewno tego chcesz \n" }, diff --git a/src/screens/DataFromBeScreen_EXAMPLE.tsx b/src/screens/DataFromBeScreen_EXAMPLE.tsx index f11f903d..41244479 100644 --- a/src/screens/DataFromBeScreen_EXAMPLE.tsx +++ b/src/screens/DataFromBeScreen_EXAMPLE.tsx @@ -1,9 +1,11 @@ import { useArticlesControllerFindAll } from '@baca/api/query/articles/articles' +import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' import { ArticleEntity } from '@baca/api/types' import { Loader, Center, Text, Box, Spacer } from '@baca/design-system' import { useScreenOptions, useTranslation } from '@baca/hooks' -import { useCallback } from 'react' -import { ListRenderItem, FlatList } from 'react-native' +import * as Application from 'expo-application' +import { useCallback, useEffect } from 'react' +import { ListRenderItem, FlatList, Platform, Linking, Alert } from 'react-native' export const DataFromBeScreen_EXAMPLE = () => { const { t } = useTranslation() @@ -15,6 +17,41 @@ export const DataFromBeScreen_EXAMPLE = () => { const { data: articles, isInitialLoading: isInitialLoadingArticles } = useArticlesControllerFindAll({ page: 1, pageSize: 10 }) + const currentVersion = Application.nativeApplicationVersion || 'unknown' + const os = Platform.OS + + const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() + + useEffect(() => { + if (os === 'ios' || os === 'android') { + checkForUpdate( + { + data: { + currentVersion, + os, + }, + }, + { + onSuccess: (data) => { + if (data.updateRequired) { + const storeUrl = + os === 'ios' + ? `https://apps.apple.com/app/id${data.appId}` + : `https://play.google.com/store/apps/details?id=${data.appId}` + Alert.alert(t('update.alert_title'), t('update.alert_message'), [ + { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, + ]) + } + }, + onError: (error) => { + console.error('Error checking for updates:', error) + Alert.alert(t('update.error_title'), t('update.error_message')) + }, + } + ) + } + }, [os, currentVersion, checkForUpdate]) + const renderItem: ListRenderItem = useCallback(({ item: { id, title } }) => { return ( diff --git a/src/utils/checkForUpdates.ts b/src/utils/checkForUpdates.ts index 8e29c4c2..3b97bf42 100644 --- a/src/utils/checkForUpdates.ts +++ b/src/utils/checkForUpdates.ts @@ -24,21 +24,22 @@ export const checkForUpdates = async (shouldReload?: boolean) => { if (isAlertOpened) return isAlertOpened = true - alert( - i18n.t('update.alert_title'), - i18n.t('update.alert_message'), - [ - { - text: i18n.t('update.restart'), - onPress: async () => { - isAlertOpened = false - await Updates.reloadAsync() - }, + alert(i18n.t('update.alert_title'), i18n.t('update.alert_message'), [ + { + text: i18n.t('common.cancel'), + onPress: () => { + isAlertOpened = false }, - ], - { cancelable: false } - ) + style: 'cancel', + }, + { + text: i18n.t('update.restart'), + onPress: async () => { + await Updates.reloadAsync() + }, + }, + ]) } catch (e) { - console.error('There was some error while checking updates', e) + console.log('There was some error while checking updates', e) } } From 3a357817e9c99c84793c1592b495860d4546f914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 13 May 2024 17:14:21 +0200 Subject: [PATCH 03/11] internationalization added --- src/api/query/articles/articles 2.ts | 469 +++++++ src/api/query/articles/articles.msw 2.ts | 254 ++++ src/api/query/auth-social/auth-social 2.ts | 249 ++++ .../query/auth-social/auth-social.msw 2.ts | 200 +++ src/api/query/auth/auth 2.ts | 1082 +++++++++++++++++ src/api/query/auth/auth.msw 2.ts | 331 +++++ src/api/query/files/files 2.ts | 245 ++++ src/api/query/files/files.msw 2.ts | 72 ++ src/api/query/health/health 2.ts | 81 ++ src/api/query/health/health.msw 2.ts | 46 + src/api/query/system/system 2.ts | 85 ++ src/api/query/system/system.msw 2.ts | 22 + src/api/query/users/users 2.ts | 402 ++++++ src/api/query/users/users.msw 2.ts | 275 +++++ src/api/types/appVersionStatusEntity 10.ts | 21 + src/api/types/appVersionStatusEntity 11.ts | 21 + src/api/types/appVersionStatusEntity 12.ts | 21 + src/api/types/appVersionStatusEntity 13.ts | 21 + src/api/types/appVersionStatusEntity 14.ts | 21 + src/api/types/appVersionStatusEntity 15.ts | 21 + src/api/types/appVersionStatusEntity 16.ts | 21 + src/api/types/appVersionStatusEntity 17.ts | 21 + src/api/types/appVersionStatusEntity 18.ts | 21 + src/api/types/appVersionStatusEntity 19.ts | 21 + src/api/types/appVersionStatusEntity 2.ts | 21 + src/api/types/appVersionStatusEntity 3.ts | 21 + src/api/types/appVersionStatusEntity 4.ts | 21 + src/api/types/appVersionStatusEntity 5.ts | 21 + src/api/types/appVersionStatusEntity 6.ts | 21 + src/api/types/appVersionStatusEntity 7.ts | 21 + src/api/types/appVersionStatusEntity 8.ts | 21 + src/api/types/appVersionStatusEntity 9.ts | 21 + src/api/types/articleEntity 2.ts | 22 + .../articlesControllerFindAllParams 2.ts | 13 + .../articlesControllerFindDraftsParams 2.ts | 13 + src/api/types/authAppleLoginDto 2.ts | 17 + src/api/types/authConfirmEmailChangeDto 2.ts | 13 + src/api/types/authConfirmEmailDto 2.ts | 13 + src/api/types/authEmailChangeDto 2.ts | 13 + src/api/types/authEmailLoginDto 2.ts | 15 + src/api/types/authEntity 2.ts | 20 + src/api/types/authFacebookLoginDto 2.ts | 13 + src/api/types/authForgotPasswordDto 2.ts | 13 + src/api/types/authGoogleLoginDto 2.ts | 13 + src/api/types/authRegisterLoginDto 2.ts | 19 + .../types/authResendVerificationEmailDto 2.ts | 13 + src/api/types/authResetPasswordDto 2.ts | 15 + src/api/types/authUpdateDto 2.ts | 21 + src/api/types/authorPublicDto 2.ts | 14 + src/api/types/checkUpdateDto 2.ts | 16 + src/api/types/checkUpdateDtoOs 2.ts | 19 + src/api/types/createArticleDto 2.ts | 15 + src/api/types/createUserDto 2.ts | 27 + src/api/types/errorEntity 2.ts | 17 + src/api/types/errorServerEntity 2.ts | 15 + src/api/types/errorTooManyRequestsEntity 2.ts | 15 + src/api/types/errorUnauthorizedEntity 2.ts | 15 + src/api/types/errorValidationEntity 2.ts | 16 + .../types/errorValidationEntityErrors 2.ts | 13 + src/api/types/fileEntity 2.ts | 27 + .../types/filesControllerUploadFileBody 2.ts | 13 + src/api/types/healthCheckInfoDto 2.ts | 18 + src/api/types/healthCheckStatusDto 2.ts | 13 + src/api/types/healthEntity 2.ts | 21 + src/api/types/healthEntityError 2.ts | 13 + src/api/types/index 2.ts | 54 + src/api/types/lastConsentEntity 2.ts | 23 + src/api/types/refreshEntity 2.ts | 17 + src/api/types/role 2.ts | 17 + src/api/types/roleDto 2.ts | 13 + src/api/types/roleId 2.ts | 19 + src/api/types/roleName 2.ts | 19 + src/api/types/status 2.ts | 15 + src/api/types/statusDto 2.ts | 13 + src/api/types/updateArticleDto 2.ts | 15 + src/api/types/updateUserDto 2.ts | 31 + src/api/types/userEntity 2.ts | 27 + .../types/usersControllerFindAllParams 2.ts | 13 + src/screens/DataFromBeScreen_EXAMPLE.tsx | 2 +- 79 files changed, 5001 insertions(+), 1 deletion(-) create mode 100644 src/api/query/articles/articles 2.ts create mode 100644 src/api/query/articles/articles.msw 2.ts create mode 100644 src/api/query/auth-social/auth-social 2.ts create mode 100644 src/api/query/auth-social/auth-social.msw 2.ts create mode 100644 src/api/query/auth/auth 2.ts create mode 100644 src/api/query/auth/auth.msw 2.ts create mode 100644 src/api/query/files/files 2.ts create mode 100644 src/api/query/files/files.msw 2.ts create mode 100644 src/api/query/health/health 2.ts create mode 100644 src/api/query/health/health.msw 2.ts create mode 100644 src/api/query/system/system 2.ts create mode 100644 src/api/query/system/system.msw 2.ts create mode 100644 src/api/query/users/users 2.ts create mode 100644 src/api/query/users/users.msw 2.ts create mode 100644 src/api/types/appVersionStatusEntity 10.ts create mode 100644 src/api/types/appVersionStatusEntity 11.ts create mode 100644 src/api/types/appVersionStatusEntity 12.ts create mode 100644 src/api/types/appVersionStatusEntity 13.ts create mode 100644 src/api/types/appVersionStatusEntity 14.ts create mode 100644 src/api/types/appVersionStatusEntity 15.ts create mode 100644 src/api/types/appVersionStatusEntity 16.ts create mode 100644 src/api/types/appVersionStatusEntity 17.ts create mode 100644 src/api/types/appVersionStatusEntity 18.ts create mode 100644 src/api/types/appVersionStatusEntity 19.ts create mode 100644 src/api/types/appVersionStatusEntity 2.ts create mode 100644 src/api/types/appVersionStatusEntity 3.ts create mode 100644 src/api/types/appVersionStatusEntity 4.ts create mode 100644 src/api/types/appVersionStatusEntity 5.ts create mode 100644 src/api/types/appVersionStatusEntity 6.ts create mode 100644 src/api/types/appVersionStatusEntity 7.ts create mode 100644 src/api/types/appVersionStatusEntity 8.ts create mode 100644 src/api/types/appVersionStatusEntity 9.ts create mode 100644 src/api/types/articleEntity 2.ts create mode 100644 src/api/types/articlesControllerFindAllParams 2.ts create mode 100644 src/api/types/articlesControllerFindDraftsParams 2.ts create mode 100644 src/api/types/authAppleLoginDto 2.ts create mode 100644 src/api/types/authConfirmEmailChangeDto 2.ts create mode 100644 src/api/types/authConfirmEmailDto 2.ts create mode 100644 src/api/types/authEmailChangeDto 2.ts create mode 100644 src/api/types/authEmailLoginDto 2.ts create mode 100644 src/api/types/authEntity 2.ts create mode 100644 src/api/types/authFacebookLoginDto 2.ts create mode 100644 src/api/types/authForgotPasswordDto 2.ts create mode 100644 src/api/types/authGoogleLoginDto 2.ts create mode 100644 src/api/types/authRegisterLoginDto 2.ts create mode 100644 src/api/types/authResendVerificationEmailDto 2.ts create mode 100644 src/api/types/authResetPasswordDto 2.ts create mode 100644 src/api/types/authUpdateDto 2.ts create mode 100644 src/api/types/authorPublicDto 2.ts create mode 100644 src/api/types/checkUpdateDto 2.ts create mode 100644 src/api/types/checkUpdateDtoOs 2.ts create mode 100644 src/api/types/createArticleDto 2.ts create mode 100644 src/api/types/createUserDto 2.ts create mode 100644 src/api/types/errorEntity 2.ts create mode 100644 src/api/types/errorServerEntity 2.ts create mode 100644 src/api/types/errorTooManyRequestsEntity 2.ts create mode 100644 src/api/types/errorUnauthorizedEntity 2.ts create mode 100644 src/api/types/errorValidationEntity 2.ts create mode 100644 src/api/types/errorValidationEntityErrors 2.ts create mode 100644 src/api/types/fileEntity 2.ts create mode 100644 src/api/types/filesControllerUploadFileBody 2.ts create mode 100644 src/api/types/healthCheckInfoDto 2.ts create mode 100644 src/api/types/healthCheckStatusDto 2.ts create mode 100644 src/api/types/healthEntity 2.ts create mode 100644 src/api/types/healthEntityError 2.ts create mode 100644 src/api/types/index 2.ts create mode 100644 src/api/types/lastConsentEntity 2.ts create mode 100644 src/api/types/refreshEntity 2.ts create mode 100644 src/api/types/role 2.ts create mode 100644 src/api/types/roleDto 2.ts create mode 100644 src/api/types/roleId 2.ts create mode 100644 src/api/types/roleName 2.ts create mode 100644 src/api/types/status 2.ts create mode 100644 src/api/types/statusDto 2.ts create mode 100644 src/api/types/updateArticleDto 2.ts create mode 100644 src/api/types/updateUserDto 2.ts create mode 100644 src/api/types/userEntity 2.ts create mode 100644 src/api/types/usersControllerFindAllParams 2.ts diff --git a/src/api/query/articles/articles 2.ts b/src/api/query/articles/articles 2.ts new file mode 100644 index 00000000..f905a8f1 --- /dev/null +++ b/src/api/query/articles/articles 2.ts @@ -0,0 +1,469 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation, useQuery } from '@tanstack/react-query' +import type { + MutationFunction, + QueryFunction, + QueryKey, + UseMutationOptions, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { + ArticleEntity, + ArticlesControllerFindAllParams, + ArticlesControllerFindDraftsParams, + CreateArticleDto, + ErrorServerEntity, + ErrorValidationEntity, + UpdateArticleDto, +} from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Creates a new article with the provided details. + * @summary Create Article + */ +export const articlesControllerCreate = ( + createArticleDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/articles`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: createArticleDto, + }, + options + ) +} + +export const getArticlesControllerCreateMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return articlesControllerCreate(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type ArticlesControllerCreateMutationResult = NonNullable< + Awaited> +> +export type ArticlesControllerCreateMutationBody = BodyType +export type ArticlesControllerCreateMutationError = ErrorType< + ErrorValidationEntity | ErrorServerEntity +> + +/** + * @summary Create Article + */ +export const useArticlesControllerCreate = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getArticlesControllerCreateMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Retrieves a list of all articles with pagination support. + * @summary Find All Articles + */ +export const articlesControllerFindAll = ( + params: ArticlesControllerFindAllParams, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance( + { url: `/api/v1/articles`, method: 'GET', params, signal }, + options + ) +} + +export const getArticlesControllerFindAllQueryKey = (params: ArticlesControllerFindAllParams) => { + return [`/api/v1/articles`, ...(params ? [params] : [])] as const +} + +export const getArticlesControllerFindAllQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + params: ArticlesControllerFindAllParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindAllQueryKey(params) + + const queryFn: QueryFunction>> = ({ + signal, + }) => articlesControllerFindAll(params, requestOptions, signal) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type ArticlesControllerFindAllQueryResult = NonNullable< + Awaited> +> +export type ArticlesControllerFindAllQueryError = ErrorType + +/** + * @summary Find All Articles + */ +export const useArticlesControllerFindAll = < + TData = Awaited>, + TError = ErrorType +>( + params: ArticlesControllerFindAllParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getArticlesControllerFindAllQueryOptions(params, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Retrieves a list of draft articles with pagination support. + * @summary Find Draft Articles + */ +export const articlesControllerFindDrafts = ( + params: ArticlesControllerFindDraftsParams, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance( + { url: `/api/v1/articles/drafts`, method: 'GET', params, signal }, + options + ) +} + +export const getArticlesControllerFindDraftsQueryKey = ( + params: ArticlesControllerFindDraftsParams +) => { + return [`/api/v1/articles/drafts`, ...(params ? [params] : [])] as const +} + +export const getArticlesControllerFindDraftsQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + params: ArticlesControllerFindDraftsParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindDraftsQueryKey(params) + + const queryFn: QueryFunction>> = ({ + signal, + }) => articlesControllerFindDrafts(params, requestOptions, signal) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type ArticlesControllerFindDraftsQueryResult = NonNullable< + Awaited> +> +export type ArticlesControllerFindDraftsQueryError = ErrorType + +/** + * @summary Find Draft Articles + */ +export const useArticlesControllerFindDrafts = < + TData = Awaited>, + TError = ErrorType +>( + params: ArticlesControllerFindDraftsParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getArticlesControllerFindDraftsQueryOptions(params, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Retrieves an article by its unique identifier. + * @summary Find Article by ID + */ +export const articlesControllerFindOne = ( + id: number, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance( + { url: `/api/v1/articles/${id}`, method: 'GET', signal }, + options + ) +} + +export const getArticlesControllerFindOneQueryKey = (id: number) => { + return [`/api/v1/articles/${id}`] as const +} + +export const getArticlesControllerFindOneQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + id: number, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindOneQueryKey(id) + + const queryFn: QueryFunction>> = ({ + signal, + }) => articlesControllerFindOne(id, requestOptions, signal) + + return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type ArticlesControllerFindOneQueryResult = NonNullable< + Awaited> +> +export type ArticlesControllerFindOneQueryError = ErrorType + +/** + * @summary Find Article by ID + */ +export const useArticlesControllerFindOne = < + TData = Awaited>, + TError = ErrorType +>( + id: number, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getArticlesControllerFindOneQueryOptions(id, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Updates an article with the provided details. + * @summary Update Article + */ +export const articlesControllerUpdate = ( + id: number, + updateArticleDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/articles/${id}`, + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + data: updateArticleDto, + }, + options + ) +} + +export const getArticlesControllerUpdateMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: BodyType } + > = (props) => { + const { id, data } = props ?? {} + + return articlesControllerUpdate(id, data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type ArticlesControllerUpdateMutationResult = NonNullable< + Awaited> +> +export type ArticlesControllerUpdateMutationBody = BodyType +export type ArticlesControllerUpdateMutationError = ErrorType< + ErrorValidationEntity | ErrorServerEntity +> + +/** + * @summary Update Article + */ +export const useArticlesControllerUpdate = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getArticlesControllerUpdateMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Deletes an article by its unique identifier. + * @summary Remove Article + */ +export const articlesControllerRemove = ( + id: number, + options?: SecondParameter +) => { + return customInstance({ url: `/api/v1/articles/${id}`, method: 'DELETE' }, options) +} + +export const getArticlesControllerRemoveMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {} + + return articlesControllerRemove(id, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type ArticlesControllerRemoveMutationResult = NonNullable< + Awaited> +> + +export type ArticlesControllerRemoveMutationError = ErrorType + +/** + * @summary Remove Article + */ +export const useArticlesControllerRemove = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getArticlesControllerRemoveMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/articles/articles.msw 2.ts b/src/api/query/articles/articles.msw 2.ts new file mode 100644 index 00000000..e7db37ab --- /dev/null +++ b/src/api/query/articles/articles.msw 2.ts @@ -0,0 +1,254 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { ArticleEntity } from '../../types' + +export const getArticlesControllerCreateResponseMock = ( + overrideResponse: any = {} +): ArticleEntity => ({ + author: { + email: faker.word.sample(), + firstName: faker.word.sample(), + lastName: faker.word.sample(), + ...overrideResponse, + }, + authorId: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + body: faker.word.sample(), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + description: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + id: faker.number.int({ min: undefined, max: undefined }), + published: faker.datatype.boolean(), + title: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getArticlesControllerFindAllResponseMock = ( + overrideResponse: any = {} +): ArticleEntity[] => + Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ + author: { + email: faker.word.sample(), + firstName: faker.word.sample(), + lastName: faker.word.sample(), + ...overrideResponse, + }, + authorId: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + body: faker.word.sample(), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + description: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + id: faker.number.int({ min: undefined, max: undefined }), + published: faker.datatype.boolean(), + title: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + })) + +export const getArticlesControllerFindDraftsResponseMock = ( + overrideResponse: any = {} +): ArticleEntity[] => + Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ + author: { + email: faker.word.sample(), + firstName: faker.word.sample(), + lastName: faker.word.sample(), + ...overrideResponse, + }, + authorId: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + body: faker.word.sample(), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + description: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + id: faker.number.int({ min: undefined, max: undefined }), + published: faker.datatype.boolean(), + title: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + })) + +export const getArticlesControllerFindOneResponseMock = ( + overrideResponse: any = {} +): ArticleEntity => ({ + author: { + email: faker.word.sample(), + firstName: faker.word.sample(), + lastName: faker.word.sample(), + ...overrideResponse, + }, + authorId: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + body: faker.word.sample(), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + description: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + id: faker.number.int({ min: undefined, max: undefined }), + published: faker.datatype.boolean(), + title: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getArticlesControllerUpdateResponseMock = ( + overrideResponse: any = {} +): ArticleEntity => ({ + author: { + email: faker.word.sample(), + firstName: faker.word.sample(), + lastName: faker.word.sample(), + ...overrideResponse, + }, + authorId: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + body: faker.word.sample(), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + description: faker.helpers.arrayElement([ + faker.helpers.arrayElement([faker.word.sample(), null]), + undefined, + ]), + id: faker.number.int({ min: undefined, max: undefined }), + published: faker.datatype.boolean(), + title: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getArticlesControllerCreateMockHandler = (overrideResponse?: ArticleEntity) => { + return http.post('*/api/v1/articles', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getArticlesControllerCreateResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getArticlesControllerFindAllMockHandler = (overrideResponse?: ArticleEntity[]) => { + return http.get('*/api/v1/articles', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getArticlesControllerFindAllResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getArticlesControllerFindDraftsMockHandler = (overrideResponse?: ArticleEntity[]) => { + return http.get('*/api/v1/articles/drafts', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getArticlesControllerFindDraftsResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getArticlesControllerFindOneMockHandler = (overrideResponse?: ArticleEntity) => { + return http.get('*/api/v1/articles/:id', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getArticlesControllerFindOneResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getArticlesControllerUpdateMockHandler = (overrideResponse?: ArticleEntity) => { + return http.patch('*/api/v1/articles/:id', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getArticlesControllerUpdateResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getArticlesControllerRemoveMockHandler = () => { + return http.delete('*/api/v1/articles/:id', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} +export const getArticlesMock = () => [ + getArticlesControllerCreateMockHandler(), + getArticlesControllerFindAllMockHandler(), + getArticlesControllerFindDraftsMockHandler(), + getArticlesControllerFindOneMockHandler(), + getArticlesControllerUpdateMockHandler(), + getArticlesControllerRemoveMockHandler(), +] diff --git a/src/api/query/auth-social/auth-social 2.ts b/src/api/query/auth-social/auth-social 2.ts new file mode 100644 index 00000000..ad3ce63b --- /dev/null +++ b/src/api/query/auth-social/auth-social 2.ts @@ -0,0 +1,249 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation } from '@tanstack/react-query' +import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { + AuthAppleLoginDto, + AuthEntity, + AuthFacebookLoginDto, + AuthGoogleLoginDto, + ErrorEntity, + ErrorServerEntity, +} from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Logs the user into the system using Google authentication + * @summary Login with Google + */ +export const authGoogleControllerLogin = ( + authGoogleLoginDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/google/login`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authGoogleLoginDto, + }, + options + ) +} + +export const getAuthGoogleControllerLoginMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authGoogleControllerLogin(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthGoogleControllerLoginMutationResult = NonNullable< + Awaited> +> +export type AuthGoogleControllerLoginMutationBody = BodyType +export type AuthGoogleControllerLoginMutationError = ErrorType + +/** + * @summary Login with Google + */ +export const useAuthGoogleControllerLogin = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthGoogleControllerLoginMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Logs the user into the system using Facebook authentication + * @summary Login with Facebook + */ +export const authFacebookControllerLogin = ( + authFacebookLoginDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/facebook/login`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authFacebookLoginDto, + }, + options + ) +} + +export const getAuthFacebookControllerLoginMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authFacebookControllerLogin(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthFacebookControllerLoginMutationResult = NonNullable< + Awaited> +> +export type AuthFacebookControllerLoginMutationBody = BodyType +export type AuthFacebookControllerLoginMutationError = ErrorType + +/** + * @summary Login with Facebook + */ +export const useAuthFacebookControllerLogin = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthFacebookControllerLoginMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Logs the user into the system using Apple authentication + * @summary Login with Apple + */ +export const authAppleControllerLogin = ( + authAppleLoginDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/apple/login`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authAppleLoginDto, + }, + options + ) +} + +export const getAuthAppleControllerLoginMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authAppleControllerLogin(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthAppleControllerLoginMutationResult = NonNullable< + Awaited> +> +export type AuthAppleControllerLoginMutationBody = BodyType +export type AuthAppleControllerLoginMutationError = ErrorType + +/** + * @summary Login with Apple + */ +export const useAuthAppleControllerLogin = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthAppleControllerLoginMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/auth-social/auth-social.msw 2.ts b/src/api/query/auth-social/auth-social.msw 2.ts new file mode 100644 index 00000000..f7d600bb --- /dev/null +++ b/src/api/query/auth-social/auth-social.msw 2.ts @@ -0,0 +1,200 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { AuthEntity } from '../../types' + +export const getAuthGoogleControllerLoginResponseMock = ( + overrideResponse: any = {} +): AuthEntity => ({ + accessToken: faker.word.sample(), + refreshToken: faker.word.sample(), + tokenExpires: faker.number.int({ min: undefined, max: undefined }), + user: { + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + ...overrideResponse, +}) + +export const getAuthFacebookControllerLoginResponseMock = ( + overrideResponse: any = {} +): AuthEntity => ({ + accessToken: faker.word.sample(), + refreshToken: faker.word.sample(), + tokenExpires: faker.number.int({ min: undefined, max: undefined }), + user: { + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + ...overrideResponse, +}) + +export const getAuthAppleControllerLoginResponseMock = ( + overrideResponse: any = {} +): AuthEntity => ({ + accessToken: faker.word.sample(), + refreshToken: faker.word.sample(), + tokenExpires: faker.number.int({ min: undefined, max: undefined }), + user: { + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + ...overrideResponse, +}) + +export const getAuthGoogleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { + return http.post('*/api/v1/auth/google/login', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getAuthGoogleControllerLoginResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthFacebookControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { + return http.post('*/api/v1/auth/facebook/login', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getAuthFacebookControllerLoginResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthAppleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { + return http.post('*/api/v1/auth/apple/login', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getAuthAppleControllerLoginResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} +export const getAuthSocialMock = () => [ + getAuthGoogleControllerLoginMockHandler(), + getAuthFacebookControllerLoginMockHandler(), + getAuthAppleControllerLoginMockHandler(), +] diff --git a/src/api/query/auth/auth 2.ts b/src/api/query/auth/auth 2.ts new file mode 100644 index 00000000..cb0b353a --- /dev/null +++ b/src/api/query/auth/auth 2.ts @@ -0,0 +1,1082 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation, useQuery } from '@tanstack/react-query' +import type { + MutationFunction, + QueryFunction, + QueryKey, + UseMutationOptions, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { + AuthConfirmEmailChangeDto, + AuthConfirmEmailDto, + AuthEmailChangeDto, + AuthEmailLoginDto, + AuthEntity, + AuthForgotPasswordDto, + AuthRegisterLoginDto, + AuthResendVerificationEmailDto, + AuthResetPasswordDto, + AuthUpdateDto, + ErrorEntity, + ErrorServerEntity, + ErrorTooManyRequestsEntity, + ErrorUnauthorizedEntity, + ErrorValidationEntity, + RefreshEntity, + UserEntity, +} from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Logs the user into the system and returns access tokens + * @summary User Login + */ +export const authControllerLogin = ( + authEmailLoginDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/login`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authEmailLoginDto, + }, + options + ) +} + +export const getAuthControllerLoginMutationOptions = < + TError = ErrorType< + | ErrorUnauthorizedEntity + | ErrorEntity + | ErrorValidationEntity + | ErrorTooManyRequestsEntity + | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerLogin(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerLoginMutationResult = NonNullable< + Awaited> +> +export type AuthControllerLoginMutationBody = BodyType +export type AuthControllerLoginMutationError = ErrorType< + | ErrorUnauthorizedEntity + | ErrorEntity + | ErrorValidationEntity + | ErrorTooManyRequestsEntity + | ErrorServerEntity +> + +/** + * @summary User Login + */ +export const useAuthControllerLogin = < + TError = ErrorType< + | ErrorUnauthorizedEntity + | ErrorEntity + | ErrorValidationEntity + | ErrorTooManyRequestsEntity + | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerLoginMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Registers a new user with email and password + * @summary User Registration + */ +export const authControllerRegister = ( + authRegisterLoginDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/register`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authRegisterLoginDto, + }, + options + ) +} + +export const getAuthControllerRegisterMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerRegister(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerRegisterMutationResult = NonNullable< + Awaited> +> +export type AuthControllerRegisterMutationBody = BodyType +export type AuthControllerRegisterMutationError = ErrorType< + void | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary User Registration + */ +export const useAuthControllerRegister = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerRegisterMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Confirms the user's email address using the provided confirmation hash. + * @summary Confirm Email + */ +export const authControllerConfirmEmail = ( + authConfirmEmailDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/confirm`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authConfirmEmailDto, + }, + options + ) +} + +export const getAuthControllerConfirmEmailMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerConfirmEmail(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerConfirmEmailMutationResult = NonNullable< + Awaited> +> +export type AuthControllerConfirmEmailMutationBody = BodyType +export type AuthControllerConfirmEmailMutationError = ErrorType< + void | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Confirm Email + */ +export const useAuthControllerConfirmEmail = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerConfirmEmailMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Resend the verification email to the user's email address. + * @summary Resend Verification Email + */ +export const authControllerResendVerificationEmail = ( + authResendVerificationEmailDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/resend`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authResendVerificationEmailDto, + }, + options + ) +} + +export const getAuthControllerResendVerificationEmailMutationOptions = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerResendVerificationEmail(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerResendVerificationEmailMutationResult = NonNullable< + Awaited> +> +export type AuthControllerResendVerificationEmailMutationBody = + BodyType +export type AuthControllerResendVerificationEmailMutationError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Resend Verification Email + */ +export const useAuthControllerResendVerificationEmail = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerResendVerificationEmailMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Initiates the password reset process by sending an email with a reset link to the user's email address. + * @summary Forgot Password + */ +export const authControllerForgotPassword = ( + authForgotPasswordDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/forgot/password`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authForgotPasswordDto, + }, + options + ) +} + +export const getAuthControllerForgotPasswordMutationOptions = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerForgotPassword(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerForgotPasswordMutationResult = NonNullable< + Awaited> +> +export type AuthControllerForgotPasswordMutationBody = BodyType +export type AuthControllerForgotPasswordMutationError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Forgot Password + */ +export const useAuthControllerForgotPassword = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerForgotPasswordMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Resets the user's password using the provided reset password hash. + * @summary Reset Password + */ +export const authControllerResetPassword = ( + authResetPasswordDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/reset/password`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authResetPasswordDto, + }, + options + ) +} + +export const getAuthControllerResetPasswordMutationOptions = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerResetPassword(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerResetPasswordMutationResult = NonNullable< + Awaited> +> +export type AuthControllerResetPasswordMutationBody = BodyType +export type AuthControllerResetPasswordMutationError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Reset Password + */ +export const useAuthControllerResetPassword = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerResetPasswordMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Initiates the process to change the user's email address. After initialization, the user must confirm the email address change through another endpoint. + * @summary Initialize Email Change + */ +export const authControllerEmailChange = ( + authEmailChangeDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/change`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authEmailChangeDto, + }, + options + ) +} + +export const getAuthControllerEmailChangeMutationOptions = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerEmailChange(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerEmailChangeMutationResult = NonNullable< + Awaited> +> +export type AuthControllerEmailChangeMutationBody = BodyType +export type AuthControllerEmailChangeMutationError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Initialize Email Change + */ +export const useAuthControllerEmailChange = < + TError = ErrorType< + ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerEmailChangeMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Confirms the change of a user's email address using a verification code sent to the new email. This endpoint validates the verification code (hash) received by the user to complete the email address change process. + * @summary Confirm Email Change + */ +export const authControllerConfirmEmailChange = ( + authConfirmEmailChangeDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/email/change-confirm`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: authConfirmEmailChangeDto, + }, + options + ) +} + +export const getAuthControllerConfirmEmailChangeMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerConfirmEmailChange(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerConfirmEmailChangeMutationResult = NonNullable< + Awaited> +> +export type AuthControllerConfirmEmailChangeMutationBody = BodyType +export type AuthControllerConfirmEmailChangeMutationError = ErrorType< + ErrorEntity | ErrorTooManyRequestsEntity | ErrorServerEntity +> + +/** + * @summary Confirm Email Change + */ +export const useAuthControllerConfirmEmailChange = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerConfirmEmailChangeMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Retrieves information about the current authenticated user + * @summary Get Current User + */ +export const authControllerMe = ( + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance({ url: `/api/v1/auth/me`, method: 'GET', signal }, options) +} + +export const getAuthControllerMeQueryKey = () => { + return [`/api/v1/auth/me`] as const +} + +export const getAuthControllerMeQueryOptions = < + TData = Awaited>, + TError = ErrorType +>(options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getAuthControllerMeQueryKey() + + const queryFn: QueryFunction>> = ({ signal }) => + authControllerMe(requestOptions, signal) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type AuthControllerMeQueryResult = NonNullable>> +export type AuthControllerMeQueryError = ErrorType + +/** + * @summary Get Current User + */ +export const useAuthControllerMe = < + TData = Awaited>, + TError = ErrorType +>(options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter +}): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getAuthControllerMeQueryOptions(options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Updates information about the current authenticated user + * @summary Update Current User + */ +export const authControllerUpdate = ( + authUpdateDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/auth/me`, + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + data: authUpdateDto, + }, + options + ) +} + +export const getAuthControllerUpdateMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return authControllerUpdate(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerUpdateMutationResult = NonNullable< + Awaited> +> +export type AuthControllerUpdateMutationBody = BodyType +export type AuthControllerUpdateMutationError = ErrorType< + ErrorUnauthorizedEntity | void | ErrorEntity | ErrorServerEntity +> + +/** + * @summary Update Current User + */ +export const useAuthControllerUpdate = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerUpdateMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Deletes the current authenticated user + * @summary Delete Current User + */ +export const authControllerDelete = (options?: SecondParameter) => { + return customInstance({ url: `/api/v1/auth/me`, method: 'DELETE' }, options) +} + +export const getAuthControllerDeleteMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return authControllerDelete(requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerDeleteMutationResult = NonNullable< + Awaited> +> + +export type AuthControllerDeleteMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorServerEntity +> + +/** + * @summary Delete Current User + */ +export const useAuthControllerDelete = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerDeleteMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Refreshes the access token using the refresh token + * @summary Refresh Access Token + */ +export const authControllerRefresh = (options?: SecondParameter) => { + return customInstance({ url: `/api/v1/auth/refresh`, method: 'POST' }, options) +} + +export const getAuthControllerRefreshMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return authControllerRefresh(requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerRefreshMutationResult = NonNullable< + Awaited> +> + +export type AuthControllerRefreshMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorServerEntity +> + +/** + * @summary Refresh Access Token + */ +export const useAuthControllerRefresh = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerRefreshMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Logs the user out of the system + * @summary Logout + */ +export const authControllerLogout = (options?: SecondParameter) => { + return customInstance({ url: `/api/v1/auth/logout`, method: 'POST' }, options) +} + +export const getAuthControllerLogoutMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return authControllerLogout(requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerLogoutMutationResult = NonNullable< + Awaited> +> + +export type AuthControllerLogoutMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorServerEntity +> + +/** + * @summary Logout + */ +export const useAuthControllerLogout = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerLogoutMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Logs the user out of all active sessions to enhance security in case of unauthorized access or when changing sensitive account information like passwords + * @summary Logout all sessions + */ +export const authControllerLogoutAll = (options?: SecondParameter) => { + return customInstance({ url: `/api/v1/auth/logout/all`, method: 'POST' }, options) +} + +export const getAuthControllerLogoutAllMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return authControllerLogoutAll(requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type AuthControllerLogoutAllMutationResult = NonNullable< + Awaited> +> + +export type AuthControllerLogoutAllMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorServerEntity +> + +/** + * @summary Logout all sessions + */ +export const useAuthControllerLogoutAll = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getAuthControllerLogoutAllMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/auth/auth.msw 2.ts b/src/api/query/auth/auth.msw 2.ts new file mode 100644 index 00000000..28ce03d3 --- /dev/null +++ b/src/api/query/auth/auth.msw 2.ts @@ -0,0 +1,331 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { AuthEntity, RefreshEntity, UserEntity } from '../../types' + +export const getAuthControllerLoginResponseMock = (overrideResponse: any = {}): AuthEntity => ({ + accessToken: faker.word.sample(), + refreshToken: faker.word.sample(), + tokenExpires: faker.number.int({ min: undefined, max: undefined }), + user: { + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + ...overrideResponse, +}) + +export const getAuthControllerRegisterResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getAuthControllerMeResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getAuthControllerRefreshResponseMock = ( + overrideResponse: any = {} +): RefreshEntity => ({ + accessToken: faker.word.sample(), + refreshToken: faker.word.sample(), + tokenExpires: faker.number.int({ min: undefined, max: undefined }), + ...overrideResponse, +}) + +export const getAuthControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { + return http.post('*/api/v1/auth/email/login', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerLoginResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthControllerRegisterMockHandler = (overrideResponse?: UserEntity) => { + return http.post('*/api/v1/auth/email/register', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRegisterResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthControllerConfirmEmailMockHandler = () => { + return http.post('*/api/v1/auth/email/confirm', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerResendVerificationEmailMockHandler = () => { + return http.post('*/api/v1/auth/email/resend', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerForgotPasswordMockHandler = () => { + return http.post('*/api/v1/auth/forgot/password', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerResetPasswordMockHandler = () => { + return http.post('*/api/v1/auth/reset/password', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerEmailChangeMockHandler = () => { + return http.post('*/api/v1/auth/email/change', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerConfirmEmailChangeMockHandler = () => { + return http.post('*/api/v1/auth/email/change-confirm', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerMeMockHandler = (overrideResponse?: UserEntity) => { + return http.get('*/api/v1/auth/me', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerMeResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthControllerUpdateMockHandler = () => { + return http.patch('*/api/v1/auth/me', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerDeleteMockHandler = () => { + return http.delete('*/api/v1/auth/me', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerRefreshMockHandler = (overrideResponse?: RefreshEntity) => { + return http.post('*/api/v1/auth/refresh', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRefreshResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getAuthControllerLogoutMockHandler = () => { + return http.post('*/api/v1/auth/logout', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getAuthControllerLogoutAllMockHandler = () => { + return http.post('*/api/v1/auth/logout/all', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} +export const getAuthMock = () => [ + getAuthControllerLoginMockHandler(), + getAuthControllerRegisterMockHandler(), + getAuthControllerConfirmEmailMockHandler(), + getAuthControllerResendVerificationEmailMockHandler(), + getAuthControllerForgotPasswordMockHandler(), + getAuthControllerResetPasswordMockHandler(), + getAuthControllerEmailChangeMockHandler(), + getAuthControllerConfirmEmailChangeMockHandler(), + getAuthControllerMeMockHandler(), + getAuthControllerUpdateMockHandler(), + getAuthControllerDeleteMockHandler(), + getAuthControllerRefreshMockHandler(), + getAuthControllerLogoutMockHandler(), + getAuthControllerLogoutAllMockHandler(), +] diff --git a/src/api/query/files/files 2.ts b/src/api/query/files/files 2.ts new file mode 100644 index 00000000..0808d73c --- /dev/null +++ b/src/api/query/files/files 2.ts @@ -0,0 +1,245 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation, useQuery } from '@tanstack/react-query' +import type { + MutationFunction, + QueryFunction, + QueryKey, + UseMutationOptions, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { FileEntity, FilesControllerUploadFileBody } from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Uploads a file with a specified category. + * @summary Upload File + */ +export const filesControllerUploadFile = ( + filesControllerUploadFileBody: BodyType, + options?: SecondParameter +) => { + const formData = new FormData() + if (filesControllerUploadFileBody.file !== undefined) { + formData.append('file', filesControllerUploadFileBody.file) + } + if (filesControllerUploadFileBody.category !== undefined) { + formData.append('category', filesControllerUploadFileBody.category) + } + + return customInstance( + { + url: `/api/v1/files/upload`, + method: 'POST', + headers: { 'Content-Type': 'multipart/form-data' }, + data: formData, + }, + options + ) +} + +export const getFilesControllerUploadFileMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return filesControllerUploadFile(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type FilesControllerUploadFileMutationResult = NonNullable< + Awaited> +> +export type FilesControllerUploadFileMutationBody = BodyType +export type FilesControllerUploadFileMutationError = ErrorType + +/** + * @summary Upload File + */ +export const useFilesControllerUploadFile = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getFilesControllerUploadFileMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Downloads the specified file. + * @summary Download File + */ +export const filesControllerDownload = ( + fileName: string, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance( + { url: `/api/v1/files/${fileName}`, method: 'GET', signal }, + options + ) +} + +export const getFilesControllerDownloadQueryKey = (fileName: string) => { + return [`/api/v1/files/${fileName}`] as const +} + +export const getFilesControllerDownloadQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + fileName: string, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getFilesControllerDownloadQueryKey(fileName) + + const queryFn: QueryFunction>> = ({ + signal, + }) => filesControllerDownload(fileName, requestOptions, signal) + + return { queryKey, queryFn, enabled: !!fileName, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type FilesControllerDownloadQueryResult = NonNullable< + Awaited> +> +export type FilesControllerDownloadQueryError = ErrorType + +/** + * @summary Download File + */ +export const useFilesControllerDownload = < + TData = Awaited>, + TError = ErrorType +>( + fileName: string, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getFilesControllerDownloadQueryOptions(fileName, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Deletes the specified file. + * @summary Delete File + */ +export const filesControllerDeleteFile = ( + fileName: string, + options?: SecondParameter +) => { + return customInstance({ url: `/api/v1/files/${fileName}`, method: 'DELETE' }, options) +} + +export const getFilesControllerDeleteFileMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { fileName: string }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { fileName: string }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { fileName: string } + > = (props) => { + const { fileName } = props ?? {} + + return filesControllerDeleteFile(fileName, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type FilesControllerDeleteFileMutationResult = NonNullable< + Awaited> +> + +export type FilesControllerDeleteFileMutationError = ErrorType + +/** + * @summary Delete File + */ +export const useFilesControllerDeleteFile = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { fileName: string }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getFilesControllerDeleteFileMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/files/files.msw 2.ts b/src/api/query/files/files.msw 2.ts new file mode 100644 index 00000000..e749ae8e --- /dev/null +++ b/src/api/query/files/files.msw 2.ts @@ -0,0 +1,72 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { FileEntity } from '../../types' + +export const getFilesControllerUploadFileResponseMock = ( + overrideResponse: any = {} +): FileEntity => ({ + category: faker.helpers.arrayElement([faker.word.sample(), null]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + id: faker.word.sample(), + mimeType: faker.word.sample(), + name: faker.word.sample(), + path: faker.word.sample(), + size: faker.number.int({ min: undefined, max: undefined }), + userId: faker.word.sample(), + ...overrideResponse, +}) + +export const getFilesControllerUploadFileMockHandler = (overrideResponse?: FileEntity) => { + return http.post('*/api/v1/files/upload', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify( + overrideResponse ? overrideResponse : getFilesControllerUploadFileResponseMock() + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getFilesControllerDownloadMockHandler = () => { + return http.get('*/api/v1/files/:fileName', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} + +export const getFilesControllerDeleteFileMockHandler = () => { + return http.delete('*/api/v1/files/:fileName', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} +export const getFilesMock = () => [ + getFilesControllerUploadFileMockHandler(), + getFilesControllerDownloadMockHandler(), + getFilesControllerDeleteFileMockHandler(), +] diff --git a/src/api/query/health/health 2.ts b/src/api/query/health/health 2.ts new file mode 100644 index 00000000..1ee684fe --- /dev/null +++ b/src/api/query/health/health 2.ts @@ -0,0 +1,81 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useQuery } from '@tanstack/react-query' +import type { + QueryFunction, + QueryKey, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType } from '../../axios/custom-instance' +import type { ErrorEntity, HealthEntity } from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Performs a health check, verifying the database, frontend domain, and cache connectivity. + * @summary Check Health + */ +export const healthControllerCheck = ( + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance({ url: `/api/v1/health`, method: 'GET', signal }, options) +} + +export const getHealthControllerCheckQueryKey = () => { + return [`/api/v1/health`] as const +} + +export const getHealthControllerCheckQueryOptions = < + TData = Awaited>, + TError = ErrorType +>(options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getHealthControllerCheckQueryKey() + + const queryFn: QueryFunction>> = ({ signal }) => + healthControllerCheck(requestOptions, signal) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type HealthControllerCheckQueryResult = NonNullable< + Awaited> +> +export type HealthControllerCheckQueryError = ErrorType + +/** + * @summary Check Health + */ +export const useHealthControllerCheck = < + TData = Awaited>, + TError = ErrorType +>(options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter +}): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getHealthControllerCheckQueryOptions(options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} diff --git a/src/api/query/health/health.msw 2.ts b/src/api/query/health/health.msw 2.ts new file mode 100644 index 00000000..fd9a6d15 --- /dev/null +++ b/src/api/query/health/health.msw 2.ts @@ -0,0 +1,46 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { HealthEntity } from '../../types' + +export const getHealthControllerCheckResponseMock = (overrideResponse: any = {}): HealthEntity => ({ + details: { + cache: { status: faker.word.sample(), ...overrideResponse }, + db: { status: faker.word.sample(), ...overrideResponse }, + domain: { status: faker.word.sample(), ...overrideResponse }, + ...overrideResponse, + }, + error: {}, + info: { + cache: { status: faker.word.sample(), ...overrideResponse }, + db: { status: faker.word.sample(), ...overrideResponse }, + domain: { status: faker.word.sample(), ...overrideResponse }, + ...overrideResponse, + }, + status: faker.word.sample(), + ...overrideResponse, +}) + +export const getHealthControllerCheckMockHandler = (overrideResponse?: HealthEntity) => { + return http.get('*/api/v1/health', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getHealthControllerCheckResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} +export const getHealthMock = () => [getHealthControllerCheckMockHandler()] diff --git a/src/api/query/system/system 2.ts b/src/api/query/system/system 2.ts new file mode 100644 index 00000000..e52669b0 --- /dev/null +++ b/src/api/query/system/system 2.ts @@ -0,0 +1,85 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation } from '@tanstack/react-query' +import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { CheckUpdateDto } from '../../types' + +type SecondParameter any> = Parameters[1] + +export const systemControllerCheckForAppUpdate = ( + checkUpdateDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/system/app-updates/check`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: checkUpdateDto, + }, + options + ) +} + +export const getSystemControllerCheckForAppUpdateMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return systemControllerCheckForAppUpdate(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type SystemControllerCheckForAppUpdateMutationResult = NonNullable< + Awaited> +> +export type SystemControllerCheckForAppUpdateMutationBody = BodyType +export type SystemControllerCheckForAppUpdateMutationError = ErrorType + +export const useSystemControllerCheckForAppUpdate = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getSystemControllerCheckForAppUpdateMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/system/system.msw 2.ts b/src/api/query/system/system.msw 2.ts new file mode 100644 index 00000000..fff0efcc --- /dev/null +++ b/src/api/query/system/system.msw 2.ts @@ -0,0 +1,22 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { HttpResponse, delay, http } from 'msw' + +export const getSystemControllerCheckForAppUpdateMockHandler = () => { + return http.post('*/api/v1/system/app-updates/check', async () => { + await delay(1000) + return new HttpResponse(null, { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }) + }) +} +export const getSystemMock = () => [getSystemControllerCheckForAppUpdateMockHandler()] diff --git a/src/api/query/users/users 2.ts b/src/api/query/users/users 2.ts new file mode 100644 index 00000000..952dc8e7 --- /dev/null +++ b/src/api/query/users/users 2.ts @@ -0,0 +1,402 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { useMutation, useQuery } from '@tanstack/react-query' +import type { + MutationFunction, + QueryFunction, + QueryKey, + UseMutationOptions, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' + +import { customInstance } from '../../axios/custom-instance' +import type { ErrorType, BodyType } from '../../axios/custom-instance' +import type { + CreateUserDto, + ErrorEntity, + ErrorServerEntity, + ErrorUnauthorizedEntity, + ErrorValidationEntity, + UpdateUserDto, + UserEntity, + UsersControllerFindAllParams, +} from '../../types' + +type SecondParameter any> = Parameters[1] + +/** + * Creates a new user. + * @summary Create User + */ +export const usersControllerCreate = ( + createUserDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/users`, + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + data: createUserDto, + }, + options + ) +} + +export const getUsersControllerCreateMutationOptions = < + TError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { data: BodyType } + > = (props) => { + const { data } = props ?? {} + + return usersControllerCreate(data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type UsersControllerCreateMutationResult = NonNullable< + Awaited> +> +export type UsersControllerCreateMutationBody = BodyType +export type UsersControllerCreateMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity +> + +/** + * @summary Create User + */ +export const useUsersControllerCreate = < + TError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity + >, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getUsersControllerCreateMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Retrieves a list of all users. + * @summary Find All Users + */ +export const usersControllerFindAll = ( + params: UsersControllerFindAllParams, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance( + { url: `/api/v1/users`, method: 'GET', params, signal }, + options + ) +} + +export const getUsersControllerFindAllQueryKey = (params: UsersControllerFindAllParams) => { + return [`/api/v1/users`, ...(params ? [params] : [])] as const +} + +export const getUsersControllerFindAllQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + params: UsersControllerFindAllParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getUsersControllerFindAllQueryKey(params) + + const queryFn: QueryFunction>> = ({ signal }) => + usersControllerFindAll(params, requestOptions, signal) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type UsersControllerFindAllQueryResult = NonNullable< + Awaited> +> +export type UsersControllerFindAllQueryError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity +> + +/** + * @summary Find All Users + */ +export const useUsersControllerFindAll = < + TData = Awaited>, + TError = ErrorType +>( + params: UsersControllerFindAllParams, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getUsersControllerFindAllQueryOptions(params, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Retrieves a user by its ID. + * @summary Find User by ID + */ +export const usersControllerFindOne = ( + id: string, + options?: SecondParameter, + signal?: AbortSignal +) => { + return customInstance({ url: `/api/v1/users/${id}`, method: 'GET', signal }, options) +} + +export const getUsersControllerFindOneQueryKey = (id: string) => { + return [`/api/v1/users/${id}`] as const +} + +export const getUsersControllerFindOneQueryOptions = < + TData = Awaited>, + TError = ErrorType +>( + id: string, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {} + + const queryKey = queryOptions?.queryKey ?? getUsersControllerFindOneQueryKey(id) + + const queryFn: QueryFunction>> = ({ signal }) => + usersControllerFindOne(id, requestOptions, signal) + + return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: QueryKey } +} + +export type UsersControllerFindOneQueryResult = NonNullable< + Awaited> +> +export type UsersControllerFindOneQueryError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity +> + +/** + * @summary Find User by ID + */ +export const useUsersControllerFindOne = < + TData = Awaited>, + TError = ErrorType +>( + id: string, + options?: { + query?: UseQueryOptions>, TError, TData> + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getUsersControllerFindOneQueryOptions(id, options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } + + query.queryKey = queryOptions.queryKey + + return query +} + +/** + * Updates a user with the provided details. + * @summary Update User + */ +export const usersControllerUpdate = ( + id: string, + updateUserDto: BodyType, + options?: SecondParameter +) => { + return customInstance( + { + url: `/api/v1/users/${id}`, + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + data: updateUserDto, + }, + options + ) +} + +export const getUsersControllerUpdateMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: string; data: BodyType }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { id: string; data: BodyType }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { id: string; data: BodyType } + > = (props) => { + const { id, data } = props ?? {} + + return usersControllerUpdate(id, data, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type UsersControllerUpdateMutationResult = NonNullable< + Awaited> +> +export type UsersControllerUpdateMutationBody = BodyType +export type UsersControllerUpdateMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity +> + +/** + * @summary Update User + */ +export const useUsersControllerUpdate = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: string; data: BodyType }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getUsersControllerUpdateMutationOptions(options) + + return useMutation(mutationOptions) +} +/** + * Deletes a user by their unique identifier. + * @summary Remove User + */ +export const usersControllerRemove = ( + id: string, + options?: SecondParameter +) => { + return customInstance({ url: `/api/v1/users/${id}`, method: 'DELETE' }, options) +} + +export const getUsersControllerRemoveMutationOptions = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: string }, + TContext + > + request?: SecondParameter +}): UseMutationOptions< + Awaited>, + TError, + { id: string }, + TContext +> => { + const { mutation: mutationOptions, request: requestOptions } = options ?? {} + + const mutationFn: MutationFunction< + Awaited>, + { id: string } + > = (props) => { + const { id } = props ?? {} + + return usersControllerRemove(id, requestOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type UsersControllerRemoveMutationResult = NonNullable< + Awaited> +> + +export type UsersControllerRemoveMutationError = ErrorType< + ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity +> + +/** + * @summary Remove User + */ +export const useUsersControllerRemove = < + TError = ErrorType, + TContext = unknown +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: string }, + TContext + > + request?: SecondParameter +}) => { + const mutationOptions = getUsersControllerRemoveMutationOptions(options) + + return useMutation(mutationOptions) +} diff --git a/src/api/query/users/users.msw 2.ts b/src/api/query/users/users.msw 2.ts new file mode 100644 index 00000000..3b8f0733 --- /dev/null +++ b/src/api/query/users/users.msw 2.ts @@ -0,0 +1,275 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import { faker } from '@faker-js/faker' +import { HttpResponse, delay, http } from 'msw' + +import type { UserEntity } from '../../types' + +export const getUsersControllerCreateResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getUsersControllerFindAllResponseMock = (overrideResponse: any = {}): UserEntity[] => + Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + })) + +export const getUsersControllerFindOneResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getUsersControllerUpdateResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getUsersControllerRemoveResponseMock = (overrideResponse: any = {}): UserEntity => ({ + consent: faker.helpers.arrayElement([ + { + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + privacyPolicyAccepted: faker.datatype.boolean(), + privacyPolicyVersion: faker.word.sample(), + termsAccepted: faker.datatype.boolean(), + termsVersion: faker.word.sample(), + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, + }, + undefined, + ]), + createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + email: faker.word.sample(), + firstName: faker.word.sample(), + id: faker.word.sample(), + lastName: faker.word.sample(), + locale: faker.word.sample(), + provider: faker.word.sample(), + role: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), + ...overrideResponse, + }, + socialId: faker.word.sample(), + status: { + id: faker.number.int({ min: undefined, max: undefined }), + name: faker.word.sample(), + ...overrideResponse, + }, + updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, + ...overrideResponse, +}) + +export const getUsersControllerCreateMockHandler = (overrideResponse?: UserEntity) => { + return http.post('*/api/v1/users', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerCreateResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getUsersControllerFindAllMockHandler = (overrideResponse?: UserEntity[]) => { + return http.get('*/api/v1/users', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerFindAllResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getUsersControllerFindOneMockHandler = (overrideResponse?: UserEntity) => { + return http.get('*/api/v1/users/:id', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerFindOneResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getUsersControllerUpdateMockHandler = (overrideResponse?: UserEntity) => { + return http.patch('*/api/v1/users/:id', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerUpdateResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} + +export const getUsersControllerRemoveMockHandler = (overrideResponse?: UserEntity) => { + return http.delete('*/api/v1/users/:id', async () => { + await delay(1000) + return new HttpResponse( + JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerRemoveResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + }) +} +export const getUsersMock = () => [ + getUsersControllerCreateMockHandler(), + getUsersControllerFindAllMockHandler(), + getUsersControllerFindOneMockHandler(), + getUsersControllerUpdateMockHandler(), + getUsersControllerRemoveMockHandler(), +] diff --git a/src/api/types/appVersionStatusEntity 10.ts b/src/api/types/appVersionStatusEntity 10.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 10.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 11.ts b/src/api/types/appVersionStatusEntity 11.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 11.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 12.ts b/src/api/types/appVersionStatusEntity 12.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 12.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 13.ts b/src/api/types/appVersionStatusEntity 13.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 13.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 14.ts b/src/api/types/appVersionStatusEntity 14.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 14.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 15.ts b/src/api/types/appVersionStatusEntity 15.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 15.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 16.ts b/src/api/types/appVersionStatusEntity 16.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 16.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 17.ts b/src/api/types/appVersionStatusEntity 17.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 17.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 18.ts b/src/api/types/appVersionStatusEntity 18.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 18.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 19.ts b/src/api/types/appVersionStatusEntity 19.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 19.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 2.ts b/src/api/types/appVersionStatusEntity 2.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 2.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 3.ts b/src/api/types/appVersionStatusEntity 3.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 3.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 4.ts b/src/api/types/appVersionStatusEntity 4.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 4.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 5.ts b/src/api/types/appVersionStatusEntity 5.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 5.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 6.ts b/src/api/types/appVersionStatusEntity 6.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 6.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 7.ts b/src/api/types/appVersionStatusEntity 7.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 7.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 8.ts b/src/api/types/appVersionStatusEntity 8.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 8.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/appVersionStatusEntity 9.ts b/src/api/types/appVersionStatusEntity 9.ts new file mode 100644 index 00000000..92511021 --- /dev/null +++ b/src/api/types/appVersionStatusEntity 9.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AppVersionStatusEntity { + /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ + appId: string + /** The current version of the app. */ + currentVersionReleaseDate: string + /** The latest version of the app available in the app store. */ + latestVersion: string + /** The minimum version of the app that still functions correctly without mandatory updates. */ + minimumVersion: string + /** Indicates whether an update is required to continue using the app. */ + updateRequired: boolean +} diff --git a/src/api/types/articleEntity 2.ts b/src/api/types/articleEntity 2.ts new file mode 100644 index 00000000..13c4eabd --- /dev/null +++ b/src/api/types/articleEntity 2.ts @@ -0,0 +1,22 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { AuthorPublicDto } from './authorPublicDto' + +export interface ArticleEntity { + author: AuthorPublicDto + authorId?: string | null + body: string + createdAt: string + deletedAt: string + description?: string | null + id: number + published: boolean + title: string + updatedAt: string +} diff --git a/src/api/types/articlesControllerFindAllParams 2.ts b/src/api/types/articlesControllerFindAllParams 2.ts new file mode 100644 index 00000000..2551c41f --- /dev/null +++ b/src/api/types/articlesControllerFindAllParams 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export type ArticlesControllerFindAllParams = { + page: number + pageSize: number +} diff --git a/src/api/types/articlesControllerFindDraftsParams 2.ts b/src/api/types/articlesControllerFindDraftsParams 2.ts new file mode 100644 index 00000000..c81e01df --- /dev/null +++ b/src/api/types/articlesControllerFindDraftsParams 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export type ArticlesControllerFindDraftsParams = { + page: number + pageSize: number +} diff --git a/src/api/types/authAppleLoginDto 2.ts b/src/api/types/authAppleLoginDto 2.ts new file mode 100644 index 00000000..c1a1df71 --- /dev/null +++ b/src/api/types/authAppleLoginDto 2.ts @@ -0,0 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthAppleLoginDto { + /** The first name of the user. This field is optional and can be provided by Apple during the first sign-in. */ + firstName?: string + /** The identity token issued by Apple, encoded in JWT format. */ + idToken: string + /** The last name of the user. This field is optional and can be provided by Apple during the first sign-in. */ + lastName?: string +} diff --git a/src/api/types/authConfirmEmailChangeDto 2.ts b/src/api/types/authConfirmEmailChangeDto 2.ts new file mode 100644 index 00000000..fbae8aee --- /dev/null +++ b/src/api/types/authConfirmEmailChangeDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthConfirmEmailChangeDto { + /** The confirmation hash received in the email. */ + hash: string +} diff --git a/src/api/types/authConfirmEmailDto 2.ts b/src/api/types/authConfirmEmailDto 2.ts new file mode 100644 index 00000000..240c78eb --- /dev/null +++ b/src/api/types/authConfirmEmailDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthConfirmEmailDto { + /** The confirmation hash received in the email. */ + hash: string +} diff --git a/src/api/types/authEmailChangeDto 2.ts b/src/api/types/authEmailChangeDto 2.ts new file mode 100644 index 00000000..d1901a30 --- /dev/null +++ b/src/api/types/authEmailChangeDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthEmailChangeDto { + /** The email address associated with the user account. */ + email: string +} diff --git a/src/api/types/authEmailLoginDto 2.ts b/src/api/types/authEmailLoginDto 2.ts new file mode 100644 index 00000000..11f8765f --- /dev/null +++ b/src/api/types/authEmailLoginDto 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthEmailLoginDto { + /** The email address used for logging in. */ + email: string + /** The password used for logging in. */ + password: string +} diff --git a/src/api/types/authEntity 2.ts b/src/api/types/authEntity 2.ts new file mode 100644 index 00000000..7c5d1476 --- /dev/null +++ b/src/api/types/authEntity 2.ts @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { UserEntity } from './userEntity' + +export interface AuthEntity { + /** The access token for authentication. */ + accessToken: string + /** The refresh token for refreshing the access token. */ + refreshToken: string + /** The expiry timestamp of the access token. */ + tokenExpires: number + /** The user entity associated with the authentication. */ + user: UserEntity +} diff --git a/src/api/types/authFacebookLoginDto 2.ts b/src/api/types/authFacebookLoginDto 2.ts new file mode 100644 index 00000000..6783c449 --- /dev/null +++ b/src/api/types/authFacebookLoginDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthFacebookLoginDto { + /** Access token obtained from Facebook after successful authentication. */ + accessToken: string +} diff --git a/src/api/types/authForgotPasswordDto 2.ts b/src/api/types/authForgotPasswordDto 2.ts new file mode 100644 index 00000000..a5c6d868 --- /dev/null +++ b/src/api/types/authForgotPasswordDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthForgotPasswordDto { + /** The email address associated with the user account. */ + email: string +} diff --git a/src/api/types/authGoogleLoginDto 2.ts b/src/api/types/authGoogleLoginDto 2.ts new file mode 100644 index 00000000..67b9f6da --- /dev/null +++ b/src/api/types/authGoogleLoginDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthGoogleLoginDto { + /** Google Access token obtained after user authentication using Google OAuth. Use this token to authenticate the request to the application. */ + accessToken: string +} diff --git a/src/api/types/authRegisterLoginDto 2.ts b/src/api/types/authRegisterLoginDto 2.ts new file mode 100644 index 00000000..1699b169 --- /dev/null +++ b/src/api/types/authRegisterLoginDto 2.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthRegisterLoginDto { + email: string + firstName: string + lastName: string + /** IETF language tags (e.g., en-US). */ + locale: string + password: string + privacyPolicyAccepted: boolean + termsAccepted: boolean +} diff --git a/src/api/types/authResendVerificationEmailDto 2.ts b/src/api/types/authResendVerificationEmailDto 2.ts new file mode 100644 index 00000000..0e52cd1e --- /dev/null +++ b/src/api/types/authResendVerificationEmailDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthResendVerificationEmailDto { + /** The email address associated with the user account. */ + email: string +} diff --git a/src/api/types/authResetPasswordDto 2.ts b/src/api/types/authResetPasswordDto 2.ts new file mode 100644 index 00000000..79ec7fb4 --- /dev/null +++ b/src/api/types/authResetPasswordDto 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthResetPasswordDto { + /** The hash token required for resetting the user's password. */ + hash: string + /** The new password for resetting the user's password. */ + password: string +} diff --git a/src/api/types/authUpdateDto 2.ts b/src/api/types/authUpdateDto 2.ts new file mode 100644 index 00000000..1d6365ee --- /dev/null +++ b/src/api/types/authUpdateDto 2.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthUpdateDto { + /** The first name of the user. */ + firstName?: string + /** The last name of the user. */ + lastName?: string + /** IETF language tags (e.g., en-US). */ + locale?: string + /** The old password required for security verification when updating user credentials. */ + oldPassword?: string + /** The new password for updating user credentials. */ + password?: string +} diff --git a/src/api/types/authorPublicDto 2.ts b/src/api/types/authorPublicDto 2.ts new file mode 100644 index 00000000..70c93bc9 --- /dev/null +++ b/src/api/types/authorPublicDto 2.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface AuthorPublicDto { + email: string + firstName: string + lastName: string +} diff --git a/src/api/types/checkUpdateDto 2.ts b/src/api/types/checkUpdateDto 2.ts new file mode 100644 index 00000000..12841f69 --- /dev/null +++ b/src/api/types/checkUpdateDto 2.ts @@ -0,0 +1,16 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { CheckUpdateDtoOs } from './checkUpdateDtoOs' + +export interface CheckUpdateDto { + /** The current version of the app installed on the device. */ + currentVersion: string + /** The operating system for which to check the update. Can be either "android" or "ios". */ + os: CheckUpdateDtoOs +} diff --git a/src/api/types/checkUpdateDtoOs 2.ts b/src/api/types/checkUpdateDtoOs 2.ts new file mode 100644 index 00000000..2cd45082 --- /dev/null +++ b/src/api/types/checkUpdateDtoOs 2.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +/** + * The operating system for which to check the update. Can be either "android" or "ios". + */ +export type CheckUpdateDtoOs = (typeof CheckUpdateDtoOs)[keyof typeof CheckUpdateDtoOs] + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const CheckUpdateDtoOs = { + android: 'android', + ios: 'ios', +} as const diff --git a/src/api/types/createArticleDto 2.ts b/src/api/types/createArticleDto 2.ts new file mode 100644 index 00000000..d88f3262 --- /dev/null +++ b/src/api/types/createArticleDto 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface CreateArticleDto { + body: string + description?: string + published?: boolean + title: string +} diff --git a/src/api/types/createUserDto 2.ts b/src/api/types/createUserDto 2.ts new file mode 100644 index 00000000..6df40b4c --- /dev/null +++ b/src/api/types/createUserDto 2.ts @@ -0,0 +1,27 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { RoleDto } from './roleDto' +import type { StatusDto } from './statusDto' + +export interface CreateUserDto { + /** The email address of the user. */ + email: string + /** The first name of the user. */ + firstName: string + /** The last name of the user. */ + lastName: string + /** IETF language tags (e.g., en-US). */ + locale: string + /** The password for the user account. */ + password: string + /** The role assigned to the user. */ + role: RoleDto + /** The status of the user account. */ + status: StatusDto +} diff --git a/src/api/types/errorEntity 2.ts b/src/api/types/errorEntity 2.ts new file mode 100644 index 00000000..aea52a31 --- /dev/null +++ b/src/api/types/errorEntity 2.ts @@ -0,0 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface ErrorEntity { + /** Type of error */ + error: string + /** Message describing the error */ + message: string + /** HTTP status code indicating the error */ + statusCode: number +} diff --git a/src/api/types/errorServerEntity 2.ts b/src/api/types/errorServerEntity 2.ts new file mode 100644 index 00000000..d69d365b --- /dev/null +++ b/src/api/types/errorServerEntity 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface ErrorServerEntity { + /** Type of error */ + error: string + /** HTTP status code indicating the error */ + statusCode: number +} diff --git a/src/api/types/errorTooManyRequestsEntity 2.ts b/src/api/types/errorTooManyRequestsEntity 2.ts new file mode 100644 index 00000000..a078ba8b --- /dev/null +++ b/src/api/types/errorTooManyRequestsEntity 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface ErrorTooManyRequestsEntity { + /** Type of error */ + error: string + /** HTTP status code indicating the error */ + statusCode: number +} diff --git a/src/api/types/errorUnauthorizedEntity 2.ts b/src/api/types/errorUnauthorizedEntity 2.ts new file mode 100644 index 00000000..22ca8402 --- /dev/null +++ b/src/api/types/errorUnauthorizedEntity 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface ErrorUnauthorizedEntity { + /** Type of error */ + error: string + /** HTTP status code indicating the error */ + statusCode: number +} diff --git a/src/api/types/errorValidationEntity 2.ts b/src/api/types/errorValidationEntity 2.ts new file mode 100644 index 00000000..5abc5437 --- /dev/null +++ b/src/api/types/errorValidationEntity 2.ts @@ -0,0 +1,16 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { ErrorValidationEntityErrors } from './errorValidationEntityErrors' + +export interface ErrorValidationEntity { + /** Object containing field-specific validation errors */ + errors: ErrorValidationEntityErrors + /** HTTP status code indicating the error */ + statusCode: number +} diff --git a/src/api/types/errorValidationEntityErrors 2.ts b/src/api/types/errorValidationEntityErrors 2.ts new file mode 100644 index 00000000..a8893e41 --- /dev/null +++ b/src/api/types/errorValidationEntityErrors 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +/** + * Object containing field-specific validation errors + */ +export type ErrorValidationEntityErrors = { [key: string]: string } diff --git a/src/api/types/fileEntity 2.ts b/src/api/types/fileEntity 2.ts new file mode 100644 index 00000000..39be0464 --- /dev/null +++ b/src/api/types/fileEntity 2.ts @@ -0,0 +1,27 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface FileEntity { + /** Category of the file */ + category: string | null + /** Creation date of the file */ + createdAt: string + /** Unique identifier of the file */ + id: string + /** MIME type of the file */ + mimeType: string + /** Name of the file */ + name: string + /** Path to access the file */ + path: string + /** Size of the file in bytes */ + size: number + /** Identifier of the user who owns the file */ + userId: string +} diff --git a/src/api/types/filesControllerUploadFileBody 2.ts b/src/api/types/filesControllerUploadFileBody 2.ts new file mode 100644 index 00000000..ec21a8ff --- /dev/null +++ b/src/api/types/filesControllerUploadFileBody 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export type FilesControllerUploadFileBody = { + category?: string + file?: Blob +} diff --git a/src/api/types/healthCheckInfoDto 2.ts b/src/api/types/healthCheckInfoDto 2.ts new file mode 100644 index 00000000..a91e5bde --- /dev/null +++ b/src/api/types/healthCheckInfoDto 2.ts @@ -0,0 +1,18 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { HealthCheckStatusDto } from './healthCheckStatusDto' + +export interface HealthCheckInfoDto { + /** The status of the cache */ + cache: HealthCheckStatusDto + /** The status of the database connection */ + db: HealthCheckStatusDto + /** The status of the domain */ + domain: HealthCheckStatusDto +} diff --git a/src/api/types/healthCheckStatusDto 2.ts b/src/api/types/healthCheckStatusDto 2.ts new file mode 100644 index 00000000..08efa128 --- /dev/null +++ b/src/api/types/healthCheckStatusDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface HealthCheckStatusDto { + /** The status of the component */ + status: string +} diff --git a/src/api/types/healthEntity 2.ts b/src/api/types/healthEntity 2.ts new file mode 100644 index 00000000..5cb78903 --- /dev/null +++ b/src/api/types/healthEntity 2.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { HealthCheckInfoDto } from './healthCheckInfoDto' +import type { HealthEntityError } from './healthEntityError' + +export interface HealthEntity { + /** Detailed health check results for each component */ + details: HealthCheckInfoDto + /** Details of any errors encountered during the health check */ + error: HealthEntityError + /** Detailed info about each component's health */ + info: HealthCheckInfoDto + /** Overall health status */ + status: string +} diff --git a/src/api/types/healthEntityError 2.ts b/src/api/types/healthEntityError 2.ts new file mode 100644 index 00000000..821b8468 --- /dev/null +++ b/src/api/types/healthEntityError 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +/** + * Details of any errors encountered during the health check + */ +export type HealthEntityError = { [key: string]: any } diff --git a/src/api/types/index 2.ts b/src/api/types/index 2.ts new file mode 100644 index 00000000..30320c2a --- /dev/null +++ b/src/api/types/index 2.ts @@ -0,0 +1,54 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export * from './articleEntity' +export * from './articlesControllerFindAllParams' +export * from './articlesControllerFindDraftsParams' +export * from './authAppleLoginDto' +export * from './authConfirmEmailChangeDto' +export * from './authConfirmEmailDto' +export * from './authEmailChangeDto' +export * from './authEmailLoginDto' +export * from './authEntity' +export * from './authFacebookLoginDto' +export * from './authForgotPasswordDto' +export * from './authGoogleLoginDto' +export * from './authRegisterLoginDto' +export * from './authResendVerificationEmailDto' +export * from './authResetPasswordDto' +export * from './authUpdateDto' +export * from './authorPublicDto' +export * from './checkUpdateDto' +export * from './checkUpdateDtoOs' +export * from './createArticleDto' +export * from './createUserDto' +export * from './errorEntity' +export * from './errorServerEntity' +export * from './errorTooManyRequestsEntity' +export * from './errorUnauthorizedEntity' +export * from './errorValidationEntity' +export * from './errorValidationEntityErrors' +export * from './fileEntity' +export * from './filesControllerUploadFileBody' +export * from './healthCheckInfoDto' +export * from './healthCheckStatusDto' +export * from './healthEntity' +export * from './healthEntityError' +export * from './lastConsentEntity' +export * from './refreshEntity' +export * from './role' +export * from './roleDto' +export * from './roleId' +export * from './roleName' +export * from './status' +export * from './statusDto' +export * from './updateArticleDto' +export * from './updateUserDto' +export * from './userEntity' +export * from './usersControllerFindAllParams' diff --git a/src/api/types/lastConsentEntity 2.ts b/src/api/types/lastConsentEntity 2.ts new file mode 100644 index 00000000..a26caaf8 --- /dev/null +++ b/src/api/types/lastConsentEntity 2.ts @@ -0,0 +1,23 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface LastConsentEntity { + /** The date and time when the consents were last created or the user agreed to the terms for the first time. */ + createdAt: string + /** Whether the privacy policy was accepted. */ + privacyPolicyAccepted: boolean + /** Version of privacy policy. */ + privacyPolicyVersion: string + /** Whether the terms were accepted. */ + termsAccepted: boolean + /** Version of terms. */ + termsVersion: string + /** The date and time of the last update to the consents, indicating when the user last modified their agreement or the consents were refreshed. */ + updatedAt: string +} diff --git a/src/api/types/refreshEntity 2.ts b/src/api/types/refreshEntity 2.ts new file mode 100644 index 00000000..bddcd5dc --- /dev/null +++ b/src/api/types/refreshEntity 2.ts @@ -0,0 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface RefreshEntity { + /** The access token for authentication. */ + accessToken: string + /** The refresh token for refreshing the access token. */ + refreshToken: string + /** The expiry date of the access token. */ + tokenExpires: number +} diff --git a/src/api/types/role 2.ts b/src/api/types/role 2.ts new file mode 100644 index 00000000..3b1b673b --- /dev/null +++ b/src/api/types/role 2.ts @@ -0,0 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { RoleId } from './roleId' +import type { RoleName } from './roleName' + +export interface Role { + /** Role ID, where 1 is for User and 2 is for Admin */ + id: RoleId + /** Role name, which can be either user or admin */ + name: RoleName +} diff --git a/src/api/types/roleDto 2.ts b/src/api/types/roleDto 2.ts new file mode 100644 index 00000000..1b96f8f2 --- /dev/null +++ b/src/api/types/roleDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface RoleDto { + /** The unique identifier of the role. */ + id: number +} diff --git a/src/api/types/roleId 2.ts b/src/api/types/roleId 2.ts new file mode 100644 index 00000000..b6af08e0 --- /dev/null +++ b/src/api/types/roleId 2.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +/** + * Role ID, where 1 is for User and 2 is for Admin + */ +export type RoleId = (typeof RoleId)[keyof typeof RoleId] + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const RoleId = { + NUMBER_1: 1, + NUMBER_2: 2, +} as const diff --git a/src/api/types/roleName 2.ts b/src/api/types/roleName 2.ts new file mode 100644 index 00000000..1601f332 --- /dev/null +++ b/src/api/types/roleName 2.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +/** + * Role name, which can be either user or admin + */ +export type RoleName = (typeof RoleName)[keyof typeof RoleName] + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const RoleName = { + ADMIN: 'ADMIN', + USER: 'USER', +} as const diff --git a/src/api/types/status 2.ts b/src/api/types/status 2.ts new file mode 100644 index 00000000..7de25f6c --- /dev/null +++ b/src/api/types/status 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface Status { + /** The unique identifier of the status. */ + id: number + /** The name of the status. */ + name: string +} diff --git a/src/api/types/statusDto 2.ts b/src/api/types/statusDto 2.ts new file mode 100644 index 00000000..36778270 --- /dev/null +++ b/src/api/types/statusDto 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface StatusDto { + /** The unique identifier of the status. */ + id: number +} diff --git a/src/api/types/updateArticleDto 2.ts b/src/api/types/updateArticleDto 2.ts new file mode 100644 index 00000000..45273fc6 --- /dev/null +++ b/src/api/types/updateArticleDto 2.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export interface UpdateArticleDto { + body?: string + description?: string + published?: boolean + title?: string +} diff --git a/src/api/types/updateUserDto 2.ts b/src/api/types/updateUserDto 2.ts new file mode 100644 index 00000000..af6e7cf2 --- /dev/null +++ b/src/api/types/updateUserDto 2.ts @@ -0,0 +1,31 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { RoleDto } from './roleDto' +import type { StatusDto } from './statusDto' + +export interface UpdateUserDto { + /** The updated email address of the user. */ + email?: string + /** The updated first name of the user. */ + firstName?: string + /** The updated last name of the user. */ + lastName?: string + /** IETF language tags (e.g., en-US). */ + locale?: string + /** The updated password for the user account. */ + password?: string + /** The provider associated with the user account. */ + provider: string + /** The updated role assigned to the user. */ + role?: RoleDto + /** The social ID associated with the user account. */ + socialId: string + /** The updated status of the user account. */ + status?: StatusDto +} diff --git a/src/api/types/userEntity 2.ts b/src/api/types/userEntity 2.ts new file mode 100644 index 00000000..218e4f80 --- /dev/null +++ b/src/api/types/userEntity 2.ts @@ -0,0 +1,27 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ +import type { LastConsentEntity } from './lastConsentEntity' +import type { Role } from './role' +import type { Status } from './status' + +export interface UserEntity { + consent?: LastConsentEntity + createdAt: string + deletedAt: string + email: string + firstName: string + id: string + lastName: string + locale: string + provider: string + role: Role + socialId: string + status: Status + updatedAt: string +} diff --git a/src/api/types/usersControllerFindAllParams 2.ts b/src/api/types/usersControllerFindAllParams 2.ts new file mode 100644 index 00000000..f46352b3 --- /dev/null +++ b/src/api/types/usersControllerFindAllParams 2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Generated by orval 🍺 + * Do not edit manually. + * API + * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. + * OpenAPI spec version: 1.0 + */ + +export type UsersControllerFindAllParams = { + page: number + pageSize: number +} diff --git a/src/screens/DataFromBeScreen_EXAMPLE.tsx b/src/screens/DataFromBeScreen_EXAMPLE.tsx index 41244479..02ad73be 100644 --- a/src/screens/DataFromBeScreen_EXAMPLE.tsx +++ b/src/screens/DataFromBeScreen_EXAMPLE.tsx @@ -50,7 +50,7 @@ export const DataFromBeScreen_EXAMPLE = () => { } ) } - }, [os, currentVersion, checkForUpdate]) + }, [os, currentVersion, checkForUpdate, t]) const renderItem: ListRenderItem = useCallback(({ item: { id, title } }) => { return ( From e09519a86d65e04f6835ff8d5ab28c7ee40589c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Tue, 14 May 2024 15:08:47 +0200 Subject: [PATCH 04/11] review after files collapse --- src/api/query/articles/articles 2.ts | 469 ------- src/api/query/articles/articles.msw 2.ts | 254 ---- src/api/query/auth-social/auth-social 2.ts | 249 ---- .../query/auth-social/auth-social.msw 2.ts | 200 --- src/api/query/auth/auth 2.ts | 1082 ----------------- src/api/query/auth/auth.msw 2.ts | 331 ----- src/api/query/files/files 2.ts | 245 ---- src/api/query/files/files.msw 2.ts | 72 -- src/api/query/health/health 2.ts | 81 -- src/api/query/health/health.msw 2.ts | 46 - src/api/query/system/system 2.ts | 85 -- src/api/query/system/system.msw 2.ts | 22 - src/api/query/users/users 2.ts | 402 ------ src/api/query/users/users.msw 2.ts | 275 ----- src/api/types/appVersionStatusEntity 10.ts | 21 - src/api/types/appVersionStatusEntity 11.ts | 21 - src/api/types/appVersionStatusEntity 12.ts | 21 - src/api/types/appVersionStatusEntity 13.ts | 21 - src/api/types/appVersionStatusEntity 14.ts | 21 - src/api/types/appVersionStatusEntity 15.ts | 21 - src/api/types/appVersionStatusEntity 16.ts | 21 - src/api/types/appVersionStatusEntity 17.ts | 21 - src/api/types/appVersionStatusEntity 18.ts | 21 - src/api/types/appVersionStatusEntity 19.ts | 21 - src/api/types/appVersionStatusEntity 2.ts | 21 - src/api/types/appVersionStatusEntity 3.ts | 21 - src/api/types/appVersionStatusEntity 4.ts | 21 - src/api/types/appVersionStatusEntity 5.ts | 21 - src/api/types/appVersionStatusEntity 6.ts | 21 - src/api/types/appVersionStatusEntity 7.ts | 21 - src/api/types/appVersionStatusEntity 8.ts | 21 - src/api/types/appVersionStatusEntity 9.ts | 21 - src/api/types/articleEntity 2.ts | 22 - .../articlesControllerFindAllParams 2.ts | 13 - .../articlesControllerFindDraftsParams 2.ts | 13 - src/api/types/authAppleLoginDto 2.ts | 17 - src/api/types/authConfirmEmailChangeDto 2.ts | 13 - src/api/types/authConfirmEmailDto 2.ts | 13 - src/api/types/authEmailChangeDto 2.ts | 13 - src/api/types/authEmailLoginDto 2.ts | 15 - src/api/types/authEntity 2.ts | 20 - src/api/types/authFacebookLoginDto 2.ts | 13 - src/api/types/authForgotPasswordDto 2.ts | 13 - src/api/types/authGoogleLoginDto 2.ts | 13 - src/api/types/authRegisterLoginDto 2.ts | 19 - .../types/authResendVerificationEmailDto 2.ts | 13 - src/api/types/authResetPasswordDto 2.ts | 15 - src/api/types/authUpdateDto 2.ts | 21 - src/api/types/authorPublicDto 2.ts | 14 - src/api/types/checkUpdateDto 2.ts | 16 - src/api/types/checkUpdateDtoOs 2.ts | 19 - src/api/types/createArticleDto 2.ts | 15 - src/api/types/createUserDto 2.ts | 27 - src/api/types/errorEntity 2.ts | 17 - src/api/types/errorServerEntity 2.ts | 15 - src/api/types/errorTooManyRequestsEntity 2.ts | 15 - src/api/types/errorUnauthorizedEntity 2.ts | 15 - src/api/types/errorValidationEntity 2.ts | 16 - .../types/errorValidationEntityErrors 2.ts | 13 - src/api/types/fileEntity 2.ts | 27 - .../types/filesControllerUploadFileBody 2.ts | 13 - src/api/types/healthCheckInfoDto 2.ts | 18 - src/api/types/healthCheckStatusDto 2.ts | 13 - src/api/types/healthEntity 2.ts | 21 - src/api/types/healthEntityError 2.ts | 13 - src/api/types/index 2.ts | 54 - src/api/types/lastConsentEntity 2.ts | 23 - src/api/types/refreshEntity 2.ts | 17 - src/api/types/role 2.ts | 17 - src/api/types/roleDto 2.ts | 13 - src/api/types/roleId 2.ts | 19 - src/api/types/roleName 2.ts | 19 - src/api/types/status 2.ts | 15 - src/api/types/statusDto 2.ts | 13 - src/api/types/updateArticleDto 2.ts | 15 - src/api/types/updateUserDto 2.ts | 31 - src/api/types/userEntity 2.ts | 27 - .../types/usersControllerFindAllParams 2.ts | 13 - 78 files changed, 5000 deletions(-) delete mode 100644 src/api/query/articles/articles 2.ts delete mode 100644 src/api/query/articles/articles.msw 2.ts delete mode 100644 src/api/query/auth-social/auth-social 2.ts delete mode 100644 src/api/query/auth-social/auth-social.msw 2.ts delete mode 100644 src/api/query/auth/auth 2.ts delete mode 100644 src/api/query/auth/auth.msw 2.ts delete mode 100644 src/api/query/files/files 2.ts delete mode 100644 src/api/query/files/files.msw 2.ts delete mode 100644 src/api/query/health/health 2.ts delete mode 100644 src/api/query/health/health.msw 2.ts delete mode 100644 src/api/query/system/system 2.ts delete mode 100644 src/api/query/system/system.msw 2.ts delete mode 100644 src/api/query/users/users 2.ts delete mode 100644 src/api/query/users/users.msw 2.ts delete mode 100644 src/api/types/appVersionStatusEntity 10.ts delete mode 100644 src/api/types/appVersionStatusEntity 11.ts delete mode 100644 src/api/types/appVersionStatusEntity 12.ts delete mode 100644 src/api/types/appVersionStatusEntity 13.ts delete mode 100644 src/api/types/appVersionStatusEntity 14.ts delete mode 100644 src/api/types/appVersionStatusEntity 15.ts delete mode 100644 src/api/types/appVersionStatusEntity 16.ts delete mode 100644 src/api/types/appVersionStatusEntity 17.ts delete mode 100644 src/api/types/appVersionStatusEntity 18.ts delete mode 100644 src/api/types/appVersionStatusEntity 19.ts delete mode 100644 src/api/types/appVersionStatusEntity 2.ts delete mode 100644 src/api/types/appVersionStatusEntity 3.ts delete mode 100644 src/api/types/appVersionStatusEntity 4.ts delete mode 100644 src/api/types/appVersionStatusEntity 5.ts delete mode 100644 src/api/types/appVersionStatusEntity 6.ts delete mode 100644 src/api/types/appVersionStatusEntity 7.ts delete mode 100644 src/api/types/appVersionStatusEntity 8.ts delete mode 100644 src/api/types/appVersionStatusEntity 9.ts delete mode 100644 src/api/types/articleEntity 2.ts delete mode 100644 src/api/types/articlesControllerFindAllParams 2.ts delete mode 100644 src/api/types/articlesControllerFindDraftsParams 2.ts delete mode 100644 src/api/types/authAppleLoginDto 2.ts delete mode 100644 src/api/types/authConfirmEmailChangeDto 2.ts delete mode 100644 src/api/types/authConfirmEmailDto 2.ts delete mode 100644 src/api/types/authEmailChangeDto 2.ts delete mode 100644 src/api/types/authEmailLoginDto 2.ts delete mode 100644 src/api/types/authEntity 2.ts delete mode 100644 src/api/types/authFacebookLoginDto 2.ts delete mode 100644 src/api/types/authForgotPasswordDto 2.ts delete mode 100644 src/api/types/authGoogleLoginDto 2.ts delete mode 100644 src/api/types/authRegisterLoginDto 2.ts delete mode 100644 src/api/types/authResendVerificationEmailDto 2.ts delete mode 100644 src/api/types/authResetPasswordDto 2.ts delete mode 100644 src/api/types/authUpdateDto 2.ts delete mode 100644 src/api/types/authorPublicDto 2.ts delete mode 100644 src/api/types/checkUpdateDto 2.ts delete mode 100644 src/api/types/checkUpdateDtoOs 2.ts delete mode 100644 src/api/types/createArticleDto 2.ts delete mode 100644 src/api/types/createUserDto 2.ts delete mode 100644 src/api/types/errorEntity 2.ts delete mode 100644 src/api/types/errorServerEntity 2.ts delete mode 100644 src/api/types/errorTooManyRequestsEntity 2.ts delete mode 100644 src/api/types/errorUnauthorizedEntity 2.ts delete mode 100644 src/api/types/errorValidationEntity 2.ts delete mode 100644 src/api/types/errorValidationEntityErrors 2.ts delete mode 100644 src/api/types/fileEntity 2.ts delete mode 100644 src/api/types/filesControllerUploadFileBody 2.ts delete mode 100644 src/api/types/healthCheckInfoDto 2.ts delete mode 100644 src/api/types/healthCheckStatusDto 2.ts delete mode 100644 src/api/types/healthEntity 2.ts delete mode 100644 src/api/types/healthEntityError 2.ts delete mode 100644 src/api/types/index 2.ts delete mode 100644 src/api/types/lastConsentEntity 2.ts delete mode 100644 src/api/types/refreshEntity 2.ts delete mode 100644 src/api/types/role 2.ts delete mode 100644 src/api/types/roleDto 2.ts delete mode 100644 src/api/types/roleId 2.ts delete mode 100644 src/api/types/roleName 2.ts delete mode 100644 src/api/types/status 2.ts delete mode 100644 src/api/types/statusDto 2.ts delete mode 100644 src/api/types/updateArticleDto 2.ts delete mode 100644 src/api/types/updateUserDto 2.ts delete mode 100644 src/api/types/userEntity 2.ts delete mode 100644 src/api/types/usersControllerFindAllParams 2.ts diff --git a/src/api/query/articles/articles 2.ts b/src/api/query/articles/articles 2.ts deleted file mode 100644 index f905a8f1..00000000 --- a/src/api/query/articles/articles 2.ts +++ /dev/null @@ -1,469 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation, useQuery } from '@tanstack/react-query' -import type { - MutationFunction, - QueryFunction, - QueryKey, - UseMutationOptions, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { - ArticleEntity, - ArticlesControllerFindAllParams, - ArticlesControllerFindDraftsParams, - CreateArticleDto, - ErrorServerEntity, - ErrorValidationEntity, - UpdateArticleDto, -} from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Creates a new article with the provided details. - * @summary Create Article - */ -export const articlesControllerCreate = ( - createArticleDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/articles`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: createArticleDto, - }, - options - ) -} - -export const getArticlesControllerCreateMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return articlesControllerCreate(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type ArticlesControllerCreateMutationResult = NonNullable< - Awaited> -> -export type ArticlesControllerCreateMutationBody = BodyType -export type ArticlesControllerCreateMutationError = ErrorType< - ErrorValidationEntity | ErrorServerEntity -> - -/** - * @summary Create Article - */ -export const useArticlesControllerCreate = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getArticlesControllerCreateMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Retrieves a list of all articles with pagination support. - * @summary Find All Articles - */ -export const articlesControllerFindAll = ( - params: ArticlesControllerFindAllParams, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance( - { url: `/api/v1/articles`, method: 'GET', params, signal }, - options - ) -} - -export const getArticlesControllerFindAllQueryKey = (params: ArticlesControllerFindAllParams) => { - return [`/api/v1/articles`, ...(params ? [params] : [])] as const -} - -export const getArticlesControllerFindAllQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - params: ArticlesControllerFindAllParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindAllQueryKey(params) - - const queryFn: QueryFunction>> = ({ - signal, - }) => articlesControllerFindAll(params, requestOptions, signal) - - return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type ArticlesControllerFindAllQueryResult = NonNullable< - Awaited> -> -export type ArticlesControllerFindAllQueryError = ErrorType - -/** - * @summary Find All Articles - */ -export const useArticlesControllerFindAll = < - TData = Awaited>, - TError = ErrorType ->( - params: ArticlesControllerFindAllParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getArticlesControllerFindAllQueryOptions(params, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Retrieves a list of draft articles with pagination support. - * @summary Find Draft Articles - */ -export const articlesControllerFindDrafts = ( - params: ArticlesControllerFindDraftsParams, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance( - { url: `/api/v1/articles/drafts`, method: 'GET', params, signal }, - options - ) -} - -export const getArticlesControllerFindDraftsQueryKey = ( - params: ArticlesControllerFindDraftsParams -) => { - return [`/api/v1/articles/drafts`, ...(params ? [params] : [])] as const -} - -export const getArticlesControllerFindDraftsQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - params: ArticlesControllerFindDraftsParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindDraftsQueryKey(params) - - const queryFn: QueryFunction>> = ({ - signal, - }) => articlesControllerFindDrafts(params, requestOptions, signal) - - return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type ArticlesControllerFindDraftsQueryResult = NonNullable< - Awaited> -> -export type ArticlesControllerFindDraftsQueryError = ErrorType - -/** - * @summary Find Draft Articles - */ -export const useArticlesControllerFindDrafts = < - TData = Awaited>, - TError = ErrorType ->( - params: ArticlesControllerFindDraftsParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getArticlesControllerFindDraftsQueryOptions(params, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Retrieves an article by its unique identifier. - * @summary Find Article by ID - */ -export const articlesControllerFindOne = ( - id: number, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance( - { url: `/api/v1/articles/${id}`, method: 'GET', signal }, - options - ) -} - -export const getArticlesControllerFindOneQueryKey = (id: number) => { - return [`/api/v1/articles/${id}`] as const -} - -export const getArticlesControllerFindOneQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - id: number, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getArticlesControllerFindOneQueryKey(id) - - const queryFn: QueryFunction>> = ({ - signal, - }) => articlesControllerFindOne(id, requestOptions, signal) - - return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type ArticlesControllerFindOneQueryResult = NonNullable< - Awaited> -> -export type ArticlesControllerFindOneQueryError = ErrorType - -/** - * @summary Find Article by ID - */ -export const useArticlesControllerFindOne = < - TData = Awaited>, - TError = ErrorType ->( - id: number, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getArticlesControllerFindOneQueryOptions(id, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Updates an article with the provided details. - * @summary Update Article - */ -export const articlesControllerUpdate = ( - id: number, - updateArticleDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/articles/${id}`, - method: 'PATCH', - headers: { 'Content-Type': 'application/json' }, - data: updateArticleDto, - }, - options - ) -} - -export const getArticlesControllerUpdateMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: number; data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { id: number; data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { id: number; data: BodyType } - > = (props) => { - const { id, data } = props ?? {} - - return articlesControllerUpdate(id, data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type ArticlesControllerUpdateMutationResult = NonNullable< - Awaited> -> -export type ArticlesControllerUpdateMutationBody = BodyType -export type ArticlesControllerUpdateMutationError = ErrorType< - ErrorValidationEntity | ErrorServerEntity -> - -/** - * @summary Update Article - */ -export const useArticlesControllerUpdate = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: number; data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getArticlesControllerUpdateMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Deletes an article by its unique identifier. - * @summary Remove Article - */ -export const articlesControllerRemove = ( - id: number, - options?: SecondParameter -) => { - return customInstance({ url: `/api/v1/articles/${id}`, method: 'DELETE' }, options) -} - -export const getArticlesControllerRemoveMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: number }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { id: number }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { id: number } - > = (props) => { - const { id } = props ?? {} - - return articlesControllerRemove(id, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type ArticlesControllerRemoveMutationResult = NonNullable< - Awaited> -> - -export type ArticlesControllerRemoveMutationError = ErrorType - -/** - * @summary Remove Article - */ -export const useArticlesControllerRemove = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: number }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getArticlesControllerRemoveMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/articles/articles.msw 2.ts b/src/api/query/articles/articles.msw 2.ts deleted file mode 100644 index e7db37ab..00000000 --- a/src/api/query/articles/articles.msw 2.ts +++ /dev/null @@ -1,254 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { ArticleEntity } from '../../types' - -export const getArticlesControllerCreateResponseMock = ( - overrideResponse: any = {} -): ArticleEntity => ({ - author: { - email: faker.word.sample(), - firstName: faker.word.sample(), - lastName: faker.word.sample(), - ...overrideResponse, - }, - authorId: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - body: faker.word.sample(), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - description: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - id: faker.number.int({ min: undefined, max: undefined }), - published: faker.datatype.boolean(), - title: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getArticlesControllerFindAllResponseMock = ( - overrideResponse: any = {} -): ArticleEntity[] => - Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ - author: { - email: faker.word.sample(), - firstName: faker.word.sample(), - lastName: faker.word.sample(), - ...overrideResponse, - }, - authorId: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - body: faker.word.sample(), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - description: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - id: faker.number.int({ min: undefined, max: undefined }), - published: faker.datatype.boolean(), - title: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - })) - -export const getArticlesControllerFindDraftsResponseMock = ( - overrideResponse: any = {} -): ArticleEntity[] => - Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ - author: { - email: faker.word.sample(), - firstName: faker.word.sample(), - lastName: faker.word.sample(), - ...overrideResponse, - }, - authorId: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - body: faker.word.sample(), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - description: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - id: faker.number.int({ min: undefined, max: undefined }), - published: faker.datatype.boolean(), - title: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - })) - -export const getArticlesControllerFindOneResponseMock = ( - overrideResponse: any = {} -): ArticleEntity => ({ - author: { - email: faker.word.sample(), - firstName: faker.word.sample(), - lastName: faker.word.sample(), - ...overrideResponse, - }, - authorId: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - body: faker.word.sample(), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - description: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - id: faker.number.int({ min: undefined, max: undefined }), - published: faker.datatype.boolean(), - title: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getArticlesControllerUpdateResponseMock = ( - overrideResponse: any = {} -): ArticleEntity => ({ - author: { - email: faker.word.sample(), - firstName: faker.word.sample(), - lastName: faker.word.sample(), - ...overrideResponse, - }, - authorId: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - body: faker.word.sample(), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - description: faker.helpers.arrayElement([ - faker.helpers.arrayElement([faker.word.sample(), null]), - undefined, - ]), - id: faker.number.int({ min: undefined, max: undefined }), - published: faker.datatype.boolean(), - title: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getArticlesControllerCreateMockHandler = (overrideResponse?: ArticleEntity) => { - return http.post('*/api/v1/articles', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getArticlesControllerCreateResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getArticlesControllerFindAllMockHandler = (overrideResponse?: ArticleEntity[]) => { - return http.get('*/api/v1/articles', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getArticlesControllerFindAllResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getArticlesControllerFindDraftsMockHandler = (overrideResponse?: ArticleEntity[]) => { - return http.get('*/api/v1/articles/drafts', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getArticlesControllerFindDraftsResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getArticlesControllerFindOneMockHandler = (overrideResponse?: ArticleEntity) => { - return http.get('*/api/v1/articles/:id', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getArticlesControllerFindOneResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getArticlesControllerUpdateMockHandler = (overrideResponse?: ArticleEntity) => { - return http.patch('*/api/v1/articles/:id', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getArticlesControllerUpdateResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getArticlesControllerRemoveMockHandler = () => { - return http.delete('*/api/v1/articles/:id', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} -export const getArticlesMock = () => [ - getArticlesControllerCreateMockHandler(), - getArticlesControllerFindAllMockHandler(), - getArticlesControllerFindDraftsMockHandler(), - getArticlesControllerFindOneMockHandler(), - getArticlesControllerUpdateMockHandler(), - getArticlesControllerRemoveMockHandler(), -] diff --git a/src/api/query/auth-social/auth-social 2.ts b/src/api/query/auth-social/auth-social 2.ts deleted file mode 100644 index ad3ce63b..00000000 --- a/src/api/query/auth-social/auth-social 2.ts +++ /dev/null @@ -1,249 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation } from '@tanstack/react-query' -import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { - AuthAppleLoginDto, - AuthEntity, - AuthFacebookLoginDto, - AuthGoogleLoginDto, - ErrorEntity, - ErrorServerEntity, -} from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Logs the user into the system using Google authentication - * @summary Login with Google - */ -export const authGoogleControllerLogin = ( - authGoogleLoginDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/google/login`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authGoogleLoginDto, - }, - options - ) -} - -export const getAuthGoogleControllerLoginMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authGoogleControllerLogin(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthGoogleControllerLoginMutationResult = NonNullable< - Awaited> -> -export type AuthGoogleControllerLoginMutationBody = BodyType -export type AuthGoogleControllerLoginMutationError = ErrorType - -/** - * @summary Login with Google - */ -export const useAuthGoogleControllerLogin = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthGoogleControllerLoginMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Logs the user into the system using Facebook authentication - * @summary Login with Facebook - */ -export const authFacebookControllerLogin = ( - authFacebookLoginDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/facebook/login`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authFacebookLoginDto, - }, - options - ) -} - -export const getAuthFacebookControllerLoginMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authFacebookControllerLogin(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthFacebookControllerLoginMutationResult = NonNullable< - Awaited> -> -export type AuthFacebookControllerLoginMutationBody = BodyType -export type AuthFacebookControllerLoginMutationError = ErrorType - -/** - * @summary Login with Facebook - */ -export const useAuthFacebookControllerLogin = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthFacebookControllerLoginMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Logs the user into the system using Apple authentication - * @summary Login with Apple - */ -export const authAppleControllerLogin = ( - authAppleLoginDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/apple/login`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authAppleLoginDto, - }, - options - ) -} - -export const getAuthAppleControllerLoginMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authAppleControllerLogin(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthAppleControllerLoginMutationResult = NonNullable< - Awaited> -> -export type AuthAppleControllerLoginMutationBody = BodyType -export type AuthAppleControllerLoginMutationError = ErrorType - -/** - * @summary Login with Apple - */ -export const useAuthAppleControllerLogin = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthAppleControllerLoginMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/auth-social/auth-social.msw 2.ts b/src/api/query/auth-social/auth-social.msw 2.ts deleted file mode 100644 index f7d600bb..00000000 --- a/src/api/query/auth-social/auth-social.msw 2.ts +++ /dev/null @@ -1,200 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { AuthEntity } from '../../types' - -export const getAuthGoogleControllerLoginResponseMock = ( - overrideResponse: any = {} -): AuthEntity => ({ - accessToken: faker.word.sample(), - refreshToken: faker.word.sample(), - tokenExpires: faker.number.int({ min: undefined, max: undefined }), - user: { - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - ...overrideResponse, -}) - -export const getAuthFacebookControllerLoginResponseMock = ( - overrideResponse: any = {} -): AuthEntity => ({ - accessToken: faker.word.sample(), - refreshToken: faker.word.sample(), - tokenExpires: faker.number.int({ min: undefined, max: undefined }), - user: { - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - ...overrideResponse, -}) - -export const getAuthAppleControllerLoginResponseMock = ( - overrideResponse: any = {} -): AuthEntity => ({ - accessToken: faker.word.sample(), - refreshToken: faker.word.sample(), - tokenExpires: faker.number.int({ min: undefined, max: undefined }), - user: { - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - ...overrideResponse, -}) - -export const getAuthGoogleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { - return http.post('*/api/v1/auth/google/login', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getAuthGoogleControllerLoginResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthFacebookControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { - return http.post('*/api/v1/auth/facebook/login', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getAuthFacebookControllerLoginResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthAppleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { - return http.post('*/api/v1/auth/apple/login', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getAuthAppleControllerLoginResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} -export const getAuthSocialMock = () => [ - getAuthGoogleControllerLoginMockHandler(), - getAuthFacebookControllerLoginMockHandler(), - getAuthAppleControllerLoginMockHandler(), -] diff --git a/src/api/query/auth/auth 2.ts b/src/api/query/auth/auth 2.ts deleted file mode 100644 index cb0b353a..00000000 --- a/src/api/query/auth/auth 2.ts +++ /dev/null @@ -1,1082 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation, useQuery } from '@tanstack/react-query' -import type { - MutationFunction, - QueryFunction, - QueryKey, - UseMutationOptions, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { - AuthConfirmEmailChangeDto, - AuthConfirmEmailDto, - AuthEmailChangeDto, - AuthEmailLoginDto, - AuthEntity, - AuthForgotPasswordDto, - AuthRegisterLoginDto, - AuthResendVerificationEmailDto, - AuthResetPasswordDto, - AuthUpdateDto, - ErrorEntity, - ErrorServerEntity, - ErrorTooManyRequestsEntity, - ErrorUnauthorizedEntity, - ErrorValidationEntity, - RefreshEntity, - UserEntity, -} from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Logs the user into the system and returns access tokens - * @summary User Login - */ -export const authControllerLogin = ( - authEmailLoginDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/login`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authEmailLoginDto, - }, - options - ) -} - -export const getAuthControllerLoginMutationOptions = < - TError = ErrorType< - | ErrorUnauthorizedEntity - | ErrorEntity - | ErrorValidationEntity - | ErrorTooManyRequestsEntity - | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerLogin(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerLoginMutationResult = NonNullable< - Awaited> -> -export type AuthControllerLoginMutationBody = BodyType -export type AuthControllerLoginMutationError = ErrorType< - | ErrorUnauthorizedEntity - | ErrorEntity - | ErrorValidationEntity - | ErrorTooManyRequestsEntity - | ErrorServerEntity -> - -/** - * @summary User Login - */ -export const useAuthControllerLogin = < - TError = ErrorType< - | ErrorUnauthorizedEntity - | ErrorEntity - | ErrorValidationEntity - | ErrorTooManyRequestsEntity - | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerLoginMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Registers a new user with email and password - * @summary User Registration - */ -export const authControllerRegister = ( - authRegisterLoginDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/register`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authRegisterLoginDto, - }, - options - ) -} - -export const getAuthControllerRegisterMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerRegister(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerRegisterMutationResult = NonNullable< - Awaited> -> -export type AuthControllerRegisterMutationBody = BodyType -export type AuthControllerRegisterMutationError = ErrorType< - void | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary User Registration - */ -export const useAuthControllerRegister = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerRegisterMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Confirms the user's email address using the provided confirmation hash. - * @summary Confirm Email - */ -export const authControllerConfirmEmail = ( - authConfirmEmailDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/confirm`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authConfirmEmailDto, - }, - options - ) -} - -export const getAuthControllerConfirmEmailMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerConfirmEmail(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerConfirmEmailMutationResult = NonNullable< - Awaited> -> -export type AuthControllerConfirmEmailMutationBody = BodyType -export type AuthControllerConfirmEmailMutationError = ErrorType< - void | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Confirm Email - */ -export const useAuthControllerConfirmEmail = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerConfirmEmailMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Resend the verification email to the user's email address. - * @summary Resend Verification Email - */ -export const authControllerResendVerificationEmail = ( - authResendVerificationEmailDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/resend`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authResendVerificationEmailDto, - }, - options - ) -} - -export const getAuthControllerResendVerificationEmailMutationOptions = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerResendVerificationEmail(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerResendVerificationEmailMutationResult = NonNullable< - Awaited> -> -export type AuthControllerResendVerificationEmailMutationBody = - BodyType -export type AuthControllerResendVerificationEmailMutationError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Resend Verification Email - */ -export const useAuthControllerResendVerificationEmail = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerResendVerificationEmailMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Initiates the password reset process by sending an email with a reset link to the user's email address. - * @summary Forgot Password - */ -export const authControllerForgotPassword = ( - authForgotPasswordDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/forgot/password`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authForgotPasswordDto, - }, - options - ) -} - -export const getAuthControllerForgotPasswordMutationOptions = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerForgotPassword(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerForgotPasswordMutationResult = NonNullable< - Awaited> -> -export type AuthControllerForgotPasswordMutationBody = BodyType -export type AuthControllerForgotPasswordMutationError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Forgot Password - */ -export const useAuthControllerForgotPassword = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerForgotPasswordMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Resets the user's password using the provided reset password hash. - * @summary Reset Password - */ -export const authControllerResetPassword = ( - authResetPasswordDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/reset/password`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authResetPasswordDto, - }, - options - ) -} - -export const getAuthControllerResetPasswordMutationOptions = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerResetPassword(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerResetPasswordMutationResult = NonNullable< - Awaited> -> -export type AuthControllerResetPasswordMutationBody = BodyType -export type AuthControllerResetPasswordMutationError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Reset Password - */ -export const useAuthControllerResetPassword = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerResetPasswordMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Initiates the process to change the user's email address. After initialization, the user must confirm the email address change through another endpoint. - * @summary Initialize Email Change - */ -export const authControllerEmailChange = ( - authEmailChangeDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/change`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authEmailChangeDto, - }, - options - ) -} - -export const getAuthControllerEmailChangeMutationOptions = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerEmailChange(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerEmailChangeMutationResult = NonNullable< - Awaited> -> -export type AuthControllerEmailChangeMutationBody = BodyType -export type AuthControllerEmailChangeMutationError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Initialize Email Change - */ -export const useAuthControllerEmailChange = < - TError = ErrorType< - ErrorEntity | ErrorValidationEntity | ErrorTooManyRequestsEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerEmailChangeMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Confirms the change of a user's email address using a verification code sent to the new email. This endpoint validates the verification code (hash) received by the user to complete the email address change process. - * @summary Confirm Email Change - */ -export const authControllerConfirmEmailChange = ( - authConfirmEmailChangeDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/email/change-confirm`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: authConfirmEmailChangeDto, - }, - options - ) -} - -export const getAuthControllerConfirmEmailChangeMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerConfirmEmailChange(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerConfirmEmailChangeMutationResult = NonNullable< - Awaited> -> -export type AuthControllerConfirmEmailChangeMutationBody = BodyType -export type AuthControllerConfirmEmailChangeMutationError = ErrorType< - ErrorEntity | ErrorTooManyRequestsEntity | ErrorServerEntity -> - -/** - * @summary Confirm Email Change - */ -export const useAuthControllerConfirmEmailChange = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerConfirmEmailChangeMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Retrieves information about the current authenticated user - * @summary Get Current User - */ -export const authControllerMe = ( - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance({ url: `/api/v1/auth/me`, method: 'GET', signal }, options) -} - -export const getAuthControllerMeQueryKey = () => { - return [`/api/v1/auth/me`] as const -} - -export const getAuthControllerMeQueryOptions = < - TData = Awaited>, - TError = ErrorType ->(options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter -}) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getAuthControllerMeQueryKey() - - const queryFn: QueryFunction>> = ({ signal }) => - authControllerMe(requestOptions, signal) - - return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type AuthControllerMeQueryResult = NonNullable>> -export type AuthControllerMeQueryError = ErrorType - -/** - * @summary Get Current User - */ -export const useAuthControllerMe = < - TData = Awaited>, - TError = ErrorType ->(options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter -}): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getAuthControllerMeQueryOptions(options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Updates information about the current authenticated user - * @summary Update Current User - */ -export const authControllerUpdate = ( - authUpdateDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/auth/me`, - method: 'PATCH', - headers: { 'Content-Type': 'application/json' }, - data: authUpdateDto, - }, - options - ) -} - -export const getAuthControllerUpdateMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return authControllerUpdate(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerUpdateMutationResult = NonNullable< - Awaited> -> -export type AuthControllerUpdateMutationBody = BodyType -export type AuthControllerUpdateMutationError = ErrorType< - ErrorUnauthorizedEntity | void | ErrorEntity | ErrorServerEntity -> - -/** - * @summary Update Current User - */ -export const useAuthControllerUpdate = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerUpdateMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Deletes the current authenticated user - * @summary Delete Current User - */ -export const authControllerDelete = (options?: SecondParameter) => { - return customInstance({ url: `/api/v1/auth/me`, method: 'DELETE' }, options) -} - -export const getAuthControllerDeleteMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - void, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - void - > = () => { - return authControllerDelete(requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerDeleteMutationResult = NonNullable< - Awaited> -> - -export type AuthControllerDeleteMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorServerEntity -> - -/** - * @summary Delete Current User - */ -export const useAuthControllerDelete = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerDeleteMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Refreshes the access token using the refresh token - * @summary Refresh Access Token - */ -export const authControllerRefresh = (options?: SecondParameter) => { - return customInstance({ url: `/api/v1/auth/refresh`, method: 'POST' }, options) -} - -export const getAuthControllerRefreshMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - void, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - void - > = () => { - return authControllerRefresh(requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerRefreshMutationResult = NonNullable< - Awaited> -> - -export type AuthControllerRefreshMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorServerEntity -> - -/** - * @summary Refresh Access Token - */ -export const useAuthControllerRefresh = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerRefreshMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Logs the user out of the system - * @summary Logout - */ -export const authControllerLogout = (options?: SecondParameter) => { - return customInstance({ url: `/api/v1/auth/logout`, method: 'POST' }, options) -} - -export const getAuthControllerLogoutMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - void, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - void - > = () => { - return authControllerLogout(requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerLogoutMutationResult = NonNullable< - Awaited> -> - -export type AuthControllerLogoutMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorServerEntity -> - -/** - * @summary Logout - */ -export const useAuthControllerLogout = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerLogoutMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Logs the user out of all active sessions to enhance security in case of unauthorized access or when changing sensitive account information like passwords - * @summary Logout all sessions - */ -export const authControllerLogoutAll = (options?: SecondParameter) => { - return customInstance({ url: `/api/v1/auth/logout/all`, method: 'POST' }, options) -} - -export const getAuthControllerLogoutAllMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - void, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - void - > = () => { - return authControllerLogoutAll(requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type AuthControllerLogoutAllMutationResult = NonNullable< - Awaited> -> - -export type AuthControllerLogoutAllMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorServerEntity -> - -/** - * @summary Logout all sessions - */ -export const useAuthControllerLogoutAll = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - void, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getAuthControllerLogoutAllMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/auth/auth.msw 2.ts b/src/api/query/auth/auth.msw 2.ts deleted file mode 100644 index 28ce03d3..00000000 --- a/src/api/query/auth/auth.msw 2.ts +++ /dev/null @@ -1,331 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { AuthEntity, RefreshEntity, UserEntity } from '../../types' - -export const getAuthControllerLoginResponseMock = (overrideResponse: any = {}): AuthEntity => ({ - accessToken: faker.word.sample(), - refreshToken: faker.word.sample(), - tokenExpires: faker.number.int({ min: undefined, max: undefined }), - user: { - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - ...overrideResponse, -}) - -export const getAuthControllerRegisterResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getAuthControllerMeResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getAuthControllerRefreshResponseMock = ( - overrideResponse: any = {} -): RefreshEntity => ({ - accessToken: faker.word.sample(), - refreshToken: faker.word.sample(), - tokenExpires: faker.number.int({ min: undefined, max: undefined }), - ...overrideResponse, -}) - -export const getAuthControllerLoginMockHandler = (overrideResponse?: AuthEntity) => { - return http.post('*/api/v1/auth/email/login', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerLoginResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthControllerRegisterMockHandler = (overrideResponse?: UserEntity) => { - return http.post('*/api/v1/auth/email/register', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRegisterResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthControllerConfirmEmailMockHandler = () => { - return http.post('*/api/v1/auth/email/confirm', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerResendVerificationEmailMockHandler = () => { - return http.post('*/api/v1/auth/email/resend', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerForgotPasswordMockHandler = () => { - return http.post('*/api/v1/auth/forgot/password', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerResetPasswordMockHandler = () => { - return http.post('*/api/v1/auth/reset/password', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerEmailChangeMockHandler = () => { - return http.post('*/api/v1/auth/email/change', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerConfirmEmailChangeMockHandler = () => { - return http.post('*/api/v1/auth/email/change-confirm', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerMeMockHandler = (overrideResponse?: UserEntity) => { - return http.get('*/api/v1/auth/me', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerMeResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthControllerUpdateMockHandler = () => { - return http.patch('*/api/v1/auth/me', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerDeleteMockHandler = () => { - return http.delete('*/api/v1/auth/me', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerRefreshMockHandler = (overrideResponse?: RefreshEntity) => { - return http.post('*/api/v1/auth/refresh', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRefreshResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getAuthControllerLogoutMockHandler = () => { - return http.post('*/api/v1/auth/logout', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getAuthControllerLogoutAllMockHandler = () => { - return http.post('*/api/v1/auth/logout/all', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} -export const getAuthMock = () => [ - getAuthControllerLoginMockHandler(), - getAuthControllerRegisterMockHandler(), - getAuthControllerConfirmEmailMockHandler(), - getAuthControllerResendVerificationEmailMockHandler(), - getAuthControllerForgotPasswordMockHandler(), - getAuthControllerResetPasswordMockHandler(), - getAuthControllerEmailChangeMockHandler(), - getAuthControllerConfirmEmailChangeMockHandler(), - getAuthControllerMeMockHandler(), - getAuthControllerUpdateMockHandler(), - getAuthControllerDeleteMockHandler(), - getAuthControllerRefreshMockHandler(), - getAuthControllerLogoutMockHandler(), - getAuthControllerLogoutAllMockHandler(), -] diff --git a/src/api/query/files/files 2.ts b/src/api/query/files/files 2.ts deleted file mode 100644 index 0808d73c..00000000 --- a/src/api/query/files/files 2.ts +++ /dev/null @@ -1,245 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation, useQuery } from '@tanstack/react-query' -import type { - MutationFunction, - QueryFunction, - QueryKey, - UseMutationOptions, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { FileEntity, FilesControllerUploadFileBody } from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Uploads a file with a specified category. - * @summary Upload File - */ -export const filesControllerUploadFile = ( - filesControllerUploadFileBody: BodyType, - options?: SecondParameter -) => { - const formData = new FormData() - if (filesControllerUploadFileBody.file !== undefined) { - formData.append('file', filesControllerUploadFileBody.file) - } - if (filesControllerUploadFileBody.category !== undefined) { - formData.append('category', filesControllerUploadFileBody.category) - } - - return customInstance( - { - url: `/api/v1/files/upload`, - method: 'POST', - headers: { 'Content-Type': 'multipart/form-data' }, - data: formData, - }, - options - ) -} - -export const getFilesControllerUploadFileMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return filesControllerUploadFile(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type FilesControllerUploadFileMutationResult = NonNullable< - Awaited> -> -export type FilesControllerUploadFileMutationBody = BodyType -export type FilesControllerUploadFileMutationError = ErrorType - -/** - * @summary Upload File - */ -export const useFilesControllerUploadFile = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getFilesControllerUploadFileMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Downloads the specified file. - * @summary Download File - */ -export const filesControllerDownload = ( - fileName: string, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance( - { url: `/api/v1/files/${fileName}`, method: 'GET', signal }, - options - ) -} - -export const getFilesControllerDownloadQueryKey = (fileName: string) => { - return [`/api/v1/files/${fileName}`] as const -} - -export const getFilesControllerDownloadQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - fileName: string, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getFilesControllerDownloadQueryKey(fileName) - - const queryFn: QueryFunction>> = ({ - signal, - }) => filesControllerDownload(fileName, requestOptions, signal) - - return { queryKey, queryFn, enabled: !!fileName, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type FilesControllerDownloadQueryResult = NonNullable< - Awaited> -> -export type FilesControllerDownloadQueryError = ErrorType - -/** - * @summary Download File - */ -export const useFilesControllerDownload = < - TData = Awaited>, - TError = ErrorType ->( - fileName: string, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getFilesControllerDownloadQueryOptions(fileName, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Deletes the specified file. - * @summary Delete File - */ -export const filesControllerDeleteFile = ( - fileName: string, - options?: SecondParameter -) => { - return customInstance({ url: `/api/v1/files/${fileName}`, method: 'DELETE' }, options) -} - -export const getFilesControllerDeleteFileMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { fileName: string }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { fileName: string }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { fileName: string } - > = (props) => { - const { fileName } = props ?? {} - - return filesControllerDeleteFile(fileName, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type FilesControllerDeleteFileMutationResult = NonNullable< - Awaited> -> - -export type FilesControllerDeleteFileMutationError = ErrorType - -/** - * @summary Delete File - */ -export const useFilesControllerDeleteFile = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { fileName: string }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getFilesControllerDeleteFileMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/files/files.msw 2.ts b/src/api/query/files/files.msw 2.ts deleted file mode 100644 index e749ae8e..00000000 --- a/src/api/query/files/files.msw 2.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { FileEntity } from '../../types' - -export const getFilesControllerUploadFileResponseMock = ( - overrideResponse: any = {} -): FileEntity => ({ - category: faker.helpers.arrayElement([faker.word.sample(), null]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - id: faker.word.sample(), - mimeType: faker.word.sample(), - name: faker.word.sample(), - path: faker.word.sample(), - size: faker.number.int({ min: undefined, max: undefined }), - userId: faker.word.sample(), - ...overrideResponse, -}) - -export const getFilesControllerUploadFileMockHandler = (overrideResponse?: FileEntity) => { - return http.post('*/api/v1/files/upload', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify( - overrideResponse ? overrideResponse : getFilesControllerUploadFileResponseMock() - ), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getFilesControllerDownloadMockHandler = () => { - return http.get('*/api/v1/files/:fileName', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} - -export const getFilesControllerDeleteFileMockHandler = () => { - return http.delete('*/api/v1/files/:fileName', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} -export const getFilesMock = () => [ - getFilesControllerUploadFileMockHandler(), - getFilesControllerDownloadMockHandler(), - getFilesControllerDeleteFileMockHandler(), -] diff --git a/src/api/query/health/health 2.ts b/src/api/query/health/health 2.ts deleted file mode 100644 index 1ee684fe..00000000 --- a/src/api/query/health/health 2.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useQuery } from '@tanstack/react-query' -import type { - QueryFunction, - QueryKey, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType } from '../../axios/custom-instance' -import type { ErrorEntity, HealthEntity } from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Performs a health check, verifying the database, frontend domain, and cache connectivity. - * @summary Check Health - */ -export const healthControllerCheck = ( - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance({ url: `/api/v1/health`, method: 'GET', signal }, options) -} - -export const getHealthControllerCheckQueryKey = () => { - return [`/api/v1/health`] as const -} - -export const getHealthControllerCheckQueryOptions = < - TData = Awaited>, - TError = ErrorType ->(options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter -}) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getHealthControllerCheckQueryKey() - - const queryFn: QueryFunction>> = ({ signal }) => - healthControllerCheck(requestOptions, signal) - - return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type HealthControllerCheckQueryResult = NonNullable< - Awaited> -> -export type HealthControllerCheckQueryError = ErrorType - -/** - * @summary Check Health - */ -export const useHealthControllerCheck = < - TData = Awaited>, - TError = ErrorType ->(options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter -}): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getHealthControllerCheckQueryOptions(options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} diff --git a/src/api/query/health/health.msw 2.ts b/src/api/query/health/health.msw 2.ts deleted file mode 100644 index fd9a6d15..00000000 --- a/src/api/query/health/health.msw 2.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { HealthEntity } from '../../types' - -export const getHealthControllerCheckResponseMock = (overrideResponse: any = {}): HealthEntity => ({ - details: { - cache: { status: faker.word.sample(), ...overrideResponse }, - db: { status: faker.word.sample(), ...overrideResponse }, - domain: { status: faker.word.sample(), ...overrideResponse }, - ...overrideResponse, - }, - error: {}, - info: { - cache: { status: faker.word.sample(), ...overrideResponse }, - db: { status: faker.word.sample(), ...overrideResponse }, - domain: { status: faker.word.sample(), ...overrideResponse }, - ...overrideResponse, - }, - status: faker.word.sample(), - ...overrideResponse, -}) - -export const getHealthControllerCheckMockHandler = (overrideResponse?: HealthEntity) => { - return http.get('*/api/v1/health', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getHealthControllerCheckResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} -export const getHealthMock = () => [getHealthControllerCheckMockHandler()] diff --git a/src/api/query/system/system 2.ts b/src/api/query/system/system 2.ts deleted file mode 100644 index e52669b0..00000000 --- a/src/api/query/system/system 2.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation } from '@tanstack/react-query' -import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { CheckUpdateDto } from '../../types' - -type SecondParameter any> = Parameters[1] - -export const systemControllerCheckForAppUpdate = ( - checkUpdateDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/system/app-updates/check`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: checkUpdateDto, - }, - options - ) -} - -export const getSystemControllerCheckForAppUpdateMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return systemControllerCheckForAppUpdate(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type SystemControllerCheckForAppUpdateMutationResult = NonNullable< - Awaited> -> -export type SystemControllerCheckForAppUpdateMutationBody = BodyType -export type SystemControllerCheckForAppUpdateMutationError = ErrorType - -export const useSystemControllerCheckForAppUpdate = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getSystemControllerCheckForAppUpdateMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/system/system.msw 2.ts b/src/api/query/system/system.msw 2.ts deleted file mode 100644 index fff0efcc..00000000 --- a/src/api/query/system/system.msw 2.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { HttpResponse, delay, http } from 'msw' - -export const getSystemControllerCheckForAppUpdateMockHandler = () => { - return http.post('*/api/v1/system/app-updates/check', async () => { - await delay(1000) - return new HttpResponse(null, { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - }) - }) -} -export const getSystemMock = () => [getSystemControllerCheckForAppUpdateMockHandler()] diff --git a/src/api/query/users/users 2.ts b/src/api/query/users/users 2.ts deleted file mode 100644 index 952dc8e7..00000000 --- a/src/api/query/users/users 2.ts +++ /dev/null @@ -1,402 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { useMutation, useQuery } from '@tanstack/react-query' -import type { - MutationFunction, - QueryFunction, - QueryKey, - UseMutationOptions, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' - -import { customInstance } from '../../axios/custom-instance' -import type { ErrorType, BodyType } from '../../axios/custom-instance' -import type { - CreateUserDto, - ErrorEntity, - ErrorServerEntity, - ErrorUnauthorizedEntity, - ErrorValidationEntity, - UpdateUserDto, - UserEntity, - UsersControllerFindAllParams, -} from '../../types' - -type SecondParameter any> = Parameters[1] - -/** - * Creates a new user. - * @summary Create User - */ -export const usersControllerCreate = ( - createUserDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/users`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: createUserDto, - }, - options - ) -} - -export const getUsersControllerCreateMutationOptions = < - TError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { data: BodyType } - > = (props) => { - const { data } = props ?? {} - - return usersControllerCreate(data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type UsersControllerCreateMutationResult = NonNullable< - Awaited> -> -export type UsersControllerCreateMutationBody = BodyType -export type UsersControllerCreateMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity -> - -/** - * @summary Create User - */ -export const useUsersControllerCreate = < - TError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorValidationEntity | ErrorServerEntity - >, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getUsersControllerCreateMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Retrieves a list of all users. - * @summary Find All Users - */ -export const usersControllerFindAll = ( - params: UsersControllerFindAllParams, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance( - { url: `/api/v1/users`, method: 'GET', params, signal }, - options - ) -} - -export const getUsersControllerFindAllQueryKey = (params: UsersControllerFindAllParams) => { - return [`/api/v1/users`, ...(params ? [params] : [])] as const -} - -export const getUsersControllerFindAllQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - params: UsersControllerFindAllParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getUsersControllerFindAllQueryKey(params) - - const queryFn: QueryFunction>> = ({ signal }) => - usersControllerFindAll(params, requestOptions, signal) - - return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type UsersControllerFindAllQueryResult = NonNullable< - Awaited> -> -export type UsersControllerFindAllQueryError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity -> - -/** - * @summary Find All Users - */ -export const useUsersControllerFindAll = < - TData = Awaited>, - TError = ErrorType ->( - params: UsersControllerFindAllParams, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getUsersControllerFindAllQueryOptions(params, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Retrieves a user by its ID. - * @summary Find User by ID - */ -export const usersControllerFindOne = ( - id: string, - options?: SecondParameter, - signal?: AbortSignal -) => { - return customInstance({ url: `/api/v1/users/${id}`, method: 'GET', signal }, options) -} - -export const getUsersControllerFindOneQueryKey = (id: string) => { - return [`/api/v1/users/${id}`] as const -} - -export const getUsersControllerFindOneQueryOptions = < - TData = Awaited>, - TError = ErrorType ->( - id: string, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -) => { - const { query: queryOptions, request: requestOptions } = options ?? {} - - const queryKey = queryOptions?.queryKey ?? getUsersControllerFindOneQueryKey(id) - - const queryFn: QueryFunction>> = ({ signal }) => - usersControllerFindOne(id, requestOptions, signal) - - return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: QueryKey } -} - -export type UsersControllerFindOneQueryResult = NonNullable< - Awaited> -> -export type UsersControllerFindOneQueryError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity -> - -/** - * @summary Find User by ID - */ -export const useUsersControllerFindOne = < - TData = Awaited>, - TError = ErrorType ->( - id: string, - options?: { - query?: UseQueryOptions>, TError, TData> - request?: SecondParameter - } -): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getUsersControllerFindOneQueryOptions(id, options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey } - - query.queryKey = queryOptions.queryKey - - return query -} - -/** - * Updates a user with the provided details. - * @summary Update User - */ -export const usersControllerUpdate = ( - id: string, - updateUserDto: BodyType, - options?: SecondParameter -) => { - return customInstance( - { - url: `/api/v1/users/${id}`, - method: 'PATCH', - headers: { 'Content-Type': 'application/json' }, - data: updateUserDto, - }, - options - ) -} - -export const getUsersControllerUpdateMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: string; data: BodyType }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { id: string; data: BodyType }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { id: string; data: BodyType } - > = (props) => { - const { id, data } = props ?? {} - - return usersControllerUpdate(id, data, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type UsersControllerUpdateMutationResult = NonNullable< - Awaited> -> -export type UsersControllerUpdateMutationBody = BodyType -export type UsersControllerUpdateMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity -> - -/** - * @summary Update User - */ -export const useUsersControllerUpdate = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: string; data: BodyType }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getUsersControllerUpdateMutationOptions(options) - - return useMutation(mutationOptions) -} -/** - * Deletes a user by their unique identifier. - * @summary Remove User - */ -export const usersControllerRemove = ( - id: string, - options?: SecondParameter -) => { - return customInstance({ url: `/api/v1/users/${id}`, method: 'DELETE' }, options) -} - -export const getUsersControllerRemoveMutationOptions = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: string }, - TContext - > - request?: SecondParameter -}): UseMutationOptions< - Awaited>, - TError, - { id: string }, - TContext -> => { - const { mutation: mutationOptions, request: requestOptions } = options ?? {} - - const mutationFn: MutationFunction< - Awaited>, - { id: string } - > = (props) => { - const { id } = props ?? {} - - return usersControllerRemove(id, requestOptions) - } - - return { mutationFn, ...mutationOptions } -} - -export type UsersControllerRemoveMutationResult = NonNullable< - Awaited> -> - -export type UsersControllerRemoveMutationError = ErrorType< - ErrorUnauthorizedEntity | ErrorEntity | ErrorServerEntity -> - -/** - * @summary Remove User - */ -export const useUsersControllerRemove = < - TError = ErrorType, - TContext = unknown ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { id: string }, - TContext - > - request?: SecondParameter -}) => { - const mutationOptions = getUsersControllerRemoveMutationOptions(options) - - return useMutation(mutationOptions) -} diff --git a/src/api/query/users/users.msw 2.ts b/src/api/query/users/users.msw 2.ts deleted file mode 100644 index 3b8f0733..00000000 --- a/src/api/query/users/users.msw 2.ts +++ /dev/null @@ -1,275 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import { faker } from '@faker-js/faker' -import { HttpResponse, delay, http } from 'msw' - -import type { UserEntity } from '../../types' - -export const getUsersControllerCreateResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getUsersControllerFindAllResponseMock = (overrideResponse: any = {}): UserEntity[] => - Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - })) - -export const getUsersControllerFindOneResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getUsersControllerUpdateResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getUsersControllerRemoveResponseMock = (overrideResponse: any = {}): UserEntity => ({ - consent: faker.helpers.arrayElement([ - { - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - privacyPolicyAccepted: faker.datatype.boolean(), - privacyPolicyVersion: faker.word.sample(), - termsAccepted: faker.datatype.boolean(), - termsVersion: faker.word.sample(), - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, - }, - undefined, - ]), - createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - deletedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - email: faker.word.sample(), - firstName: faker.word.sample(), - id: faker.word.sample(), - lastName: faker.word.sample(), - locale: faker.word.sample(), - provider: faker.word.sample(), - role: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.helpers.arrayElement(['ADMIN', 'USER'] as const), - ...overrideResponse, - }, - socialId: faker.word.sample(), - status: { - id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - ...overrideResponse, - }, - updatedAt: `${faker.date.past().toISOString().split('.')[0]}Z`, - ...overrideResponse, -}) - -export const getUsersControllerCreateMockHandler = (overrideResponse?: UserEntity) => { - return http.post('*/api/v1/users', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerCreateResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getUsersControllerFindAllMockHandler = (overrideResponse?: UserEntity[]) => { - return http.get('*/api/v1/users', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerFindAllResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getUsersControllerFindOneMockHandler = (overrideResponse?: UserEntity) => { - return http.get('*/api/v1/users/:id', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerFindOneResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getUsersControllerUpdateMockHandler = (overrideResponse?: UserEntity) => { - return http.patch('*/api/v1/users/:id', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerUpdateResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} - -export const getUsersControllerRemoveMockHandler = (overrideResponse?: UserEntity) => { - return http.delete('*/api/v1/users/:id', async () => { - await delay(1000) - return new HttpResponse( - JSON.stringify(overrideResponse ? overrideResponse : getUsersControllerRemoveResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - }, - } - ) - }) -} -export const getUsersMock = () => [ - getUsersControllerCreateMockHandler(), - getUsersControllerFindAllMockHandler(), - getUsersControllerFindOneMockHandler(), - getUsersControllerUpdateMockHandler(), - getUsersControllerRemoveMockHandler(), -] diff --git a/src/api/types/appVersionStatusEntity 10.ts b/src/api/types/appVersionStatusEntity 10.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 10.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 11.ts b/src/api/types/appVersionStatusEntity 11.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 11.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 12.ts b/src/api/types/appVersionStatusEntity 12.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 12.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 13.ts b/src/api/types/appVersionStatusEntity 13.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 13.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 14.ts b/src/api/types/appVersionStatusEntity 14.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 14.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 15.ts b/src/api/types/appVersionStatusEntity 15.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 15.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 16.ts b/src/api/types/appVersionStatusEntity 16.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 16.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 17.ts b/src/api/types/appVersionStatusEntity 17.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 17.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 18.ts b/src/api/types/appVersionStatusEntity 18.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 18.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 19.ts b/src/api/types/appVersionStatusEntity 19.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 19.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 2.ts b/src/api/types/appVersionStatusEntity 2.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 2.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 3.ts b/src/api/types/appVersionStatusEntity 3.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 3.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 4.ts b/src/api/types/appVersionStatusEntity 4.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 4.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 5.ts b/src/api/types/appVersionStatusEntity 5.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 5.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 6.ts b/src/api/types/appVersionStatusEntity 6.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 6.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 7.ts b/src/api/types/appVersionStatusEntity 7.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 7.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 8.ts b/src/api/types/appVersionStatusEntity 8.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 8.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/appVersionStatusEntity 9.ts b/src/api/types/appVersionStatusEntity 9.ts deleted file mode 100644 index 92511021..00000000 --- a/src/api/types/appVersionStatusEntity 9.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AppVersionStatusEntity { - /** AppId of application in AppStore(AppStore Bundle ID) or PlayStore(Google Play Store app ID) */ - appId: string - /** The current version of the app. */ - currentVersionReleaseDate: string - /** The latest version of the app available in the app store. */ - latestVersion: string - /** The minimum version of the app that still functions correctly without mandatory updates. */ - minimumVersion: string - /** Indicates whether an update is required to continue using the app. */ - updateRequired: boolean -} diff --git a/src/api/types/articleEntity 2.ts b/src/api/types/articleEntity 2.ts deleted file mode 100644 index 13c4eabd..00000000 --- a/src/api/types/articleEntity 2.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { AuthorPublicDto } from './authorPublicDto' - -export interface ArticleEntity { - author: AuthorPublicDto - authorId?: string | null - body: string - createdAt: string - deletedAt: string - description?: string | null - id: number - published: boolean - title: string - updatedAt: string -} diff --git a/src/api/types/articlesControllerFindAllParams 2.ts b/src/api/types/articlesControllerFindAllParams 2.ts deleted file mode 100644 index 2551c41f..00000000 --- a/src/api/types/articlesControllerFindAllParams 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export type ArticlesControllerFindAllParams = { - page: number - pageSize: number -} diff --git a/src/api/types/articlesControllerFindDraftsParams 2.ts b/src/api/types/articlesControllerFindDraftsParams 2.ts deleted file mode 100644 index c81e01df..00000000 --- a/src/api/types/articlesControllerFindDraftsParams 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export type ArticlesControllerFindDraftsParams = { - page: number - pageSize: number -} diff --git a/src/api/types/authAppleLoginDto 2.ts b/src/api/types/authAppleLoginDto 2.ts deleted file mode 100644 index c1a1df71..00000000 --- a/src/api/types/authAppleLoginDto 2.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthAppleLoginDto { - /** The first name of the user. This field is optional and can be provided by Apple during the first sign-in. */ - firstName?: string - /** The identity token issued by Apple, encoded in JWT format. */ - idToken: string - /** The last name of the user. This field is optional and can be provided by Apple during the first sign-in. */ - lastName?: string -} diff --git a/src/api/types/authConfirmEmailChangeDto 2.ts b/src/api/types/authConfirmEmailChangeDto 2.ts deleted file mode 100644 index fbae8aee..00000000 --- a/src/api/types/authConfirmEmailChangeDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthConfirmEmailChangeDto { - /** The confirmation hash received in the email. */ - hash: string -} diff --git a/src/api/types/authConfirmEmailDto 2.ts b/src/api/types/authConfirmEmailDto 2.ts deleted file mode 100644 index 240c78eb..00000000 --- a/src/api/types/authConfirmEmailDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthConfirmEmailDto { - /** The confirmation hash received in the email. */ - hash: string -} diff --git a/src/api/types/authEmailChangeDto 2.ts b/src/api/types/authEmailChangeDto 2.ts deleted file mode 100644 index d1901a30..00000000 --- a/src/api/types/authEmailChangeDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthEmailChangeDto { - /** The email address associated with the user account. */ - email: string -} diff --git a/src/api/types/authEmailLoginDto 2.ts b/src/api/types/authEmailLoginDto 2.ts deleted file mode 100644 index 11f8765f..00000000 --- a/src/api/types/authEmailLoginDto 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthEmailLoginDto { - /** The email address used for logging in. */ - email: string - /** The password used for logging in. */ - password: string -} diff --git a/src/api/types/authEntity 2.ts b/src/api/types/authEntity 2.ts deleted file mode 100644 index 7c5d1476..00000000 --- a/src/api/types/authEntity 2.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { UserEntity } from './userEntity' - -export interface AuthEntity { - /** The access token for authentication. */ - accessToken: string - /** The refresh token for refreshing the access token. */ - refreshToken: string - /** The expiry timestamp of the access token. */ - tokenExpires: number - /** The user entity associated with the authentication. */ - user: UserEntity -} diff --git a/src/api/types/authFacebookLoginDto 2.ts b/src/api/types/authFacebookLoginDto 2.ts deleted file mode 100644 index 6783c449..00000000 --- a/src/api/types/authFacebookLoginDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthFacebookLoginDto { - /** Access token obtained from Facebook after successful authentication. */ - accessToken: string -} diff --git a/src/api/types/authForgotPasswordDto 2.ts b/src/api/types/authForgotPasswordDto 2.ts deleted file mode 100644 index a5c6d868..00000000 --- a/src/api/types/authForgotPasswordDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthForgotPasswordDto { - /** The email address associated with the user account. */ - email: string -} diff --git a/src/api/types/authGoogleLoginDto 2.ts b/src/api/types/authGoogleLoginDto 2.ts deleted file mode 100644 index 67b9f6da..00000000 --- a/src/api/types/authGoogleLoginDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthGoogleLoginDto { - /** Google Access token obtained after user authentication using Google OAuth. Use this token to authenticate the request to the application. */ - accessToken: string -} diff --git a/src/api/types/authRegisterLoginDto 2.ts b/src/api/types/authRegisterLoginDto 2.ts deleted file mode 100644 index 1699b169..00000000 --- a/src/api/types/authRegisterLoginDto 2.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthRegisterLoginDto { - email: string - firstName: string - lastName: string - /** IETF language tags (e.g., en-US). */ - locale: string - password: string - privacyPolicyAccepted: boolean - termsAccepted: boolean -} diff --git a/src/api/types/authResendVerificationEmailDto 2.ts b/src/api/types/authResendVerificationEmailDto 2.ts deleted file mode 100644 index 0e52cd1e..00000000 --- a/src/api/types/authResendVerificationEmailDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthResendVerificationEmailDto { - /** The email address associated with the user account. */ - email: string -} diff --git a/src/api/types/authResetPasswordDto 2.ts b/src/api/types/authResetPasswordDto 2.ts deleted file mode 100644 index 79ec7fb4..00000000 --- a/src/api/types/authResetPasswordDto 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthResetPasswordDto { - /** The hash token required for resetting the user's password. */ - hash: string - /** The new password for resetting the user's password. */ - password: string -} diff --git a/src/api/types/authUpdateDto 2.ts b/src/api/types/authUpdateDto 2.ts deleted file mode 100644 index 1d6365ee..00000000 --- a/src/api/types/authUpdateDto 2.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthUpdateDto { - /** The first name of the user. */ - firstName?: string - /** The last name of the user. */ - lastName?: string - /** IETF language tags (e.g., en-US). */ - locale?: string - /** The old password required for security verification when updating user credentials. */ - oldPassword?: string - /** The new password for updating user credentials. */ - password?: string -} diff --git a/src/api/types/authorPublicDto 2.ts b/src/api/types/authorPublicDto 2.ts deleted file mode 100644 index 70c93bc9..00000000 --- a/src/api/types/authorPublicDto 2.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface AuthorPublicDto { - email: string - firstName: string - lastName: string -} diff --git a/src/api/types/checkUpdateDto 2.ts b/src/api/types/checkUpdateDto 2.ts deleted file mode 100644 index 12841f69..00000000 --- a/src/api/types/checkUpdateDto 2.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { CheckUpdateDtoOs } from './checkUpdateDtoOs' - -export interface CheckUpdateDto { - /** The current version of the app installed on the device. */ - currentVersion: string - /** The operating system for which to check the update. Can be either "android" or "ios". */ - os: CheckUpdateDtoOs -} diff --git a/src/api/types/checkUpdateDtoOs 2.ts b/src/api/types/checkUpdateDtoOs 2.ts deleted file mode 100644 index 2cd45082..00000000 --- a/src/api/types/checkUpdateDtoOs 2.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -/** - * The operating system for which to check the update. Can be either "android" or "ios". - */ -export type CheckUpdateDtoOs = (typeof CheckUpdateDtoOs)[keyof typeof CheckUpdateDtoOs] - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const CheckUpdateDtoOs = { - android: 'android', - ios: 'ios', -} as const diff --git a/src/api/types/createArticleDto 2.ts b/src/api/types/createArticleDto 2.ts deleted file mode 100644 index d88f3262..00000000 --- a/src/api/types/createArticleDto 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface CreateArticleDto { - body: string - description?: string - published?: boolean - title: string -} diff --git a/src/api/types/createUserDto 2.ts b/src/api/types/createUserDto 2.ts deleted file mode 100644 index 6df40b4c..00000000 --- a/src/api/types/createUserDto 2.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { RoleDto } from './roleDto' -import type { StatusDto } from './statusDto' - -export interface CreateUserDto { - /** The email address of the user. */ - email: string - /** The first name of the user. */ - firstName: string - /** The last name of the user. */ - lastName: string - /** IETF language tags (e.g., en-US). */ - locale: string - /** The password for the user account. */ - password: string - /** The role assigned to the user. */ - role: RoleDto - /** The status of the user account. */ - status: StatusDto -} diff --git a/src/api/types/errorEntity 2.ts b/src/api/types/errorEntity 2.ts deleted file mode 100644 index aea52a31..00000000 --- a/src/api/types/errorEntity 2.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface ErrorEntity { - /** Type of error */ - error: string - /** Message describing the error */ - message: string - /** HTTP status code indicating the error */ - statusCode: number -} diff --git a/src/api/types/errorServerEntity 2.ts b/src/api/types/errorServerEntity 2.ts deleted file mode 100644 index d69d365b..00000000 --- a/src/api/types/errorServerEntity 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface ErrorServerEntity { - /** Type of error */ - error: string - /** HTTP status code indicating the error */ - statusCode: number -} diff --git a/src/api/types/errorTooManyRequestsEntity 2.ts b/src/api/types/errorTooManyRequestsEntity 2.ts deleted file mode 100644 index a078ba8b..00000000 --- a/src/api/types/errorTooManyRequestsEntity 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface ErrorTooManyRequestsEntity { - /** Type of error */ - error: string - /** HTTP status code indicating the error */ - statusCode: number -} diff --git a/src/api/types/errorUnauthorizedEntity 2.ts b/src/api/types/errorUnauthorizedEntity 2.ts deleted file mode 100644 index 22ca8402..00000000 --- a/src/api/types/errorUnauthorizedEntity 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface ErrorUnauthorizedEntity { - /** Type of error */ - error: string - /** HTTP status code indicating the error */ - statusCode: number -} diff --git a/src/api/types/errorValidationEntity 2.ts b/src/api/types/errorValidationEntity 2.ts deleted file mode 100644 index 5abc5437..00000000 --- a/src/api/types/errorValidationEntity 2.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { ErrorValidationEntityErrors } from './errorValidationEntityErrors' - -export interface ErrorValidationEntity { - /** Object containing field-specific validation errors */ - errors: ErrorValidationEntityErrors - /** HTTP status code indicating the error */ - statusCode: number -} diff --git a/src/api/types/errorValidationEntityErrors 2.ts b/src/api/types/errorValidationEntityErrors 2.ts deleted file mode 100644 index a8893e41..00000000 --- a/src/api/types/errorValidationEntityErrors 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -/** - * Object containing field-specific validation errors - */ -export type ErrorValidationEntityErrors = { [key: string]: string } diff --git a/src/api/types/fileEntity 2.ts b/src/api/types/fileEntity 2.ts deleted file mode 100644 index 39be0464..00000000 --- a/src/api/types/fileEntity 2.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface FileEntity { - /** Category of the file */ - category: string | null - /** Creation date of the file */ - createdAt: string - /** Unique identifier of the file */ - id: string - /** MIME type of the file */ - mimeType: string - /** Name of the file */ - name: string - /** Path to access the file */ - path: string - /** Size of the file in bytes */ - size: number - /** Identifier of the user who owns the file */ - userId: string -} diff --git a/src/api/types/filesControllerUploadFileBody 2.ts b/src/api/types/filesControllerUploadFileBody 2.ts deleted file mode 100644 index ec21a8ff..00000000 --- a/src/api/types/filesControllerUploadFileBody 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export type FilesControllerUploadFileBody = { - category?: string - file?: Blob -} diff --git a/src/api/types/healthCheckInfoDto 2.ts b/src/api/types/healthCheckInfoDto 2.ts deleted file mode 100644 index a91e5bde..00000000 --- a/src/api/types/healthCheckInfoDto 2.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { HealthCheckStatusDto } from './healthCheckStatusDto' - -export interface HealthCheckInfoDto { - /** The status of the cache */ - cache: HealthCheckStatusDto - /** The status of the database connection */ - db: HealthCheckStatusDto - /** The status of the domain */ - domain: HealthCheckStatusDto -} diff --git a/src/api/types/healthCheckStatusDto 2.ts b/src/api/types/healthCheckStatusDto 2.ts deleted file mode 100644 index 08efa128..00000000 --- a/src/api/types/healthCheckStatusDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface HealthCheckStatusDto { - /** The status of the component */ - status: string -} diff --git a/src/api/types/healthEntity 2.ts b/src/api/types/healthEntity 2.ts deleted file mode 100644 index 5cb78903..00000000 --- a/src/api/types/healthEntity 2.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { HealthCheckInfoDto } from './healthCheckInfoDto' -import type { HealthEntityError } from './healthEntityError' - -export interface HealthEntity { - /** Detailed health check results for each component */ - details: HealthCheckInfoDto - /** Details of any errors encountered during the health check */ - error: HealthEntityError - /** Detailed info about each component's health */ - info: HealthCheckInfoDto - /** Overall health status */ - status: string -} diff --git a/src/api/types/healthEntityError 2.ts b/src/api/types/healthEntityError 2.ts deleted file mode 100644 index 821b8468..00000000 --- a/src/api/types/healthEntityError 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -/** - * Details of any errors encountered during the health check - */ -export type HealthEntityError = { [key: string]: any } diff --git a/src/api/types/index 2.ts b/src/api/types/index 2.ts deleted file mode 100644 index 30320c2a..00000000 --- a/src/api/types/index 2.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export * from './articleEntity' -export * from './articlesControllerFindAllParams' -export * from './articlesControllerFindDraftsParams' -export * from './authAppleLoginDto' -export * from './authConfirmEmailChangeDto' -export * from './authConfirmEmailDto' -export * from './authEmailChangeDto' -export * from './authEmailLoginDto' -export * from './authEntity' -export * from './authFacebookLoginDto' -export * from './authForgotPasswordDto' -export * from './authGoogleLoginDto' -export * from './authRegisterLoginDto' -export * from './authResendVerificationEmailDto' -export * from './authResetPasswordDto' -export * from './authUpdateDto' -export * from './authorPublicDto' -export * from './checkUpdateDto' -export * from './checkUpdateDtoOs' -export * from './createArticleDto' -export * from './createUserDto' -export * from './errorEntity' -export * from './errorServerEntity' -export * from './errorTooManyRequestsEntity' -export * from './errorUnauthorizedEntity' -export * from './errorValidationEntity' -export * from './errorValidationEntityErrors' -export * from './fileEntity' -export * from './filesControllerUploadFileBody' -export * from './healthCheckInfoDto' -export * from './healthCheckStatusDto' -export * from './healthEntity' -export * from './healthEntityError' -export * from './lastConsentEntity' -export * from './refreshEntity' -export * from './role' -export * from './roleDto' -export * from './roleId' -export * from './roleName' -export * from './status' -export * from './statusDto' -export * from './updateArticleDto' -export * from './updateUserDto' -export * from './userEntity' -export * from './usersControllerFindAllParams' diff --git a/src/api/types/lastConsentEntity 2.ts b/src/api/types/lastConsentEntity 2.ts deleted file mode 100644 index a26caaf8..00000000 --- a/src/api/types/lastConsentEntity 2.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface LastConsentEntity { - /** The date and time when the consents were last created or the user agreed to the terms for the first time. */ - createdAt: string - /** Whether the privacy policy was accepted. */ - privacyPolicyAccepted: boolean - /** Version of privacy policy. */ - privacyPolicyVersion: string - /** Whether the terms were accepted. */ - termsAccepted: boolean - /** Version of terms. */ - termsVersion: string - /** The date and time of the last update to the consents, indicating when the user last modified their agreement or the consents were refreshed. */ - updatedAt: string -} diff --git a/src/api/types/refreshEntity 2.ts b/src/api/types/refreshEntity 2.ts deleted file mode 100644 index bddcd5dc..00000000 --- a/src/api/types/refreshEntity 2.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface RefreshEntity { - /** The access token for authentication. */ - accessToken: string - /** The refresh token for refreshing the access token. */ - refreshToken: string - /** The expiry date of the access token. */ - tokenExpires: number -} diff --git a/src/api/types/role 2.ts b/src/api/types/role 2.ts deleted file mode 100644 index 3b1b673b..00000000 --- a/src/api/types/role 2.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { RoleId } from './roleId' -import type { RoleName } from './roleName' - -export interface Role { - /** Role ID, where 1 is for User and 2 is for Admin */ - id: RoleId - /** Role name, which can be either user or admin */ - name: RoleName -} diff --git a/src/api/types/roleDto 2.ts b/src/api/types/roleDto 2.ts deleted file mode 100644 index 1b96f8f2..00000000 --- a/src/api/types/roleDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface RoleDto { - /** The unique identifier of the role. */ - id: number -} diff --git a/src/api/types/roleId 2.ts b/src/api/types/roleId 2.ts deleted file mode 100644 index b6af08e0..00000000 --- a/src/api/types/roleId 2.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -/** - * Role ID, where 1 is for User and 2 is for Admin - */ -export type RoleId = (typeof RoleId)[keyof typeof RoleId] - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const RoleId = { - NUMBER_1: 1, - NUMBER_2: 2, -} as const diff --git a/src/api/types/roleName 2.ts b/src/api/types/roleName 2.ts deleted file mode 100644 index 1601f332..00000000 --- a/src/api/types/roleName 2.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -/** - * Role name, which can be either user or admin - */ -export type RoleName = (typeof RoleName)[keyof typeof RoleName] - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const RoleName = { - ADMIN: 'ADMIN', - USER: 'USER', -} as const diff --git a/src/api/types/status 2.ts b/src/api/types/status 2.ts deleted file mode 100644 index 7de25f6c..00000000 --- a/src/api/types/status 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface Status { - /** The unique identifier of the status. */ - id: number - /** The name of the status. */ - name: string -} diff --git a/src/api/types/statusDto 2.ts b/src/api/types/statusDto 2.ts deleted file mode 100644 index 36778270..00000000 --- a/src/api/types/statusDto 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface StatusDto { - /** The unique identifier of the status. */ - id: number -} diff --git a/src/api/types/updateArticleDto 2.ts b/src/api/types/updateArticleDto 2.ts deleted file mode 100644 index 45273fc6..00000000 --- a/src/api/types/updateArticleDto 2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export interface UpdateArticleDto { - body?: string - description?: string - published?: boolean - title?: string -} diff --git a/src/api/types/updateUserDto 2.ts b/src/api/types/updateUserDto 2.ts deleted file mode 100644 index af6e7cf2..00000000 --- a/src/api/types/updateUserDto 2.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { RoleDto } from './roleDto' -import type { StatusDto } from './statusDto' - -export interface UpdateUserDto { - /** The updated email address of the user. */ - email?: string - /** The updated first name of the user. */ - firstName?: string - /** The updated last name of the user. */ - lastName?: string - /** IETF language tags (e.g., en-US). */ - locale?: string - /** The updated password for the user account. */ - password?: string - /** The provider associated with the user account. */ - provider: string - /** The updated role assigned to the user. */ - role?: RoleDto - /** The social ID associated with the user account. */ - socialId: string - /** The updated status of the user account. */ - status?: StatusDto -} diff --git a/src/api/types/userEntity 2.ts b/src/api/types/userEntity 2.ts deleted file mode 100644 index 218e4f80..00000000 --- a/src/api/types/userEntity 2.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ -import type { LastConsentEntity } from './lastConsentEntity' -import type { Role } from './role' -import type { Status } from './status' - -export interface UserEntity { - consent?: LastConsentEntity - createdAt: string - deletedAt: string - email: string - firstName: string - id: string - lastName: string - locale: string - provider: string - role: Role - socialId: string - status: Status - updatedAt: string -} diff --git a/src/api/types/usersControllerFindAllParams 2.ts b/src/api/types/usersControllerFindAllParams 2.ts deleted file mode 100644 index f46352b3..00000000 --- a/src/api/types/usersControllerFindAllParams 2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/** - * Generated by orval 🍺 - * Do not edit manually. - * API - * API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources. - * OpenAPI spec version: 1.0 - */ - -export type UsersControllerFindAllParams = { - page: number - pageSize: number -} From d4b1796e8d7e9557ecc1871b5e33fea7d6eeba67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Tue, 14 May 2024 16:09:11 +0200 Subject: [PATCH 05/11] corrections applied to task forcing update --- src/components/AppLoading.tsx | 42 ++++++++++++++++++++++-- src/screens/DataFromBeScreen_EXAMPLE.tsx | 41 ++--------------------- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/src/components/AppLoading.tsx b/src/components/AppLoading.tsx index e781891d..076aeaa3 100644 --- a/src/components/AppLoading.tsx +++ b/src/components/AppLoading.tsx @@ -1,16 +1,19 @@ +import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' import { Loader, Center } from '@baca/design-system/components' -import { useCachedResources, useNavigationTheme } from '@baca/hooks' +import { useCachedResources, useNavigationTheme, useTranslation } from '@baca/hooks' import { isSignedInAtom } from '@baca/store/auth' +import * as Application from 'expo-application' import * as SplashScreen from 'expo-splash-screen' import { useAtomValue } from 'jotai' import { FC, PropsWithChildren, useCallback, useEffect, useState } from 'react' -import { View, StyleSheet } from 'react-native' +import { View, StyleSheet, Alert, Platform, Linking } from 'react-native' // Keep the splash screen visible while we fetch resources SplashScreen.preventAutoHideAsync() export const AppLoading: FC = ({ children }) => { const { navigationTheme } = useNavigationTheme() + const { t } = useTranslation() const isLoadingComplete = useCachedResources() @@ -25,6 +28,41 @@ export const AppLoading: FC = ({ children }) => { const isLoading = !isLoadingComplete || isSignedIn === null || !isLayoutReady + const currentVersion = Application.nativeApplicationVersion || 'unknown' + const os = Platform.OS + + const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() + + useEffect(() => { + if (os === 'ios' || os === 'android') { + checkForUpdate( + { + data: { + currentVersion, + os, + }, + }, + { + onSuccess: (data) => { + if (data.updateRequired) { + const storeUrl = + os === 'ios' + ? `https://apps.apple.com/app/id${data.appId}` + : `https://play.google.com/store/apps/details?id=${data.appId}` + Alert.alert(t('update.alert_title'), t('update.alert_message'), [ + { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, + ]) + } + }, + onError: (error) => { + console.error('Error checking for updates:', error) + // CONFIG: Add log to your analytics service, for example - sentry or crashlytics + }, + } + ) + } + }, [os, currentVersion, checkForUpdate, t]) + useEffect(() => { const hideSplashScreen = () => { setTimeout(async () => { diff --git a/src/screens/DataFromBeScreen_EXAMPLE.tsx b/src/screens/DataFromBeScreen_EXAMPLE.tsx index 02ad73be..f11f903d 100644 --- a/src/screens/DataFromBeScreen_EXAMPLE.tsx +++ b/src/screens/DataFromBeScreen_EXAMPLE.tsx @@ -1,11 +1,9 @@ import { useArticlesControllerFindAll } from '@baca/api/query/articles/articles' -import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' import { ArticleEntity } from '@baca/api/types' import { Loader, Center, Text, Box, Spacer } from '@baca/design-system' import { useScreenOptions, useTranslation } from '@baca/hooks' -import * as Application from 'expo-application' -import { useCallback, useEffect } from 'react' -import { ListRenderItem, FlatList, Platform, Linking, Alert } from 'react-native' +import { useCallback } from 'react' +import { ListRenderItem, FlatList } from 'react-native' export const DataFromBeScreen_EXAMPLE = () => { const { t } = useTranslation() @@ -17,41 +15,6 @@ export const DataFromBeScreen_EXAMPLE = () => { const { data: articles, isInitialLoading: isInitialLoadingArticles } = useArticlesControllerFindAll({ page: 1, pageSize: 10 }) - const currentVersion = Application.nativeApplicationVersion || 'unknown' - const os = Platform.OS - - const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() - - useEffect(() => { - if (os === 'ios' || os === 'android') { - checkForUpdate( - { - data: { - currentVersion, - os, - }, - }, - { - onSuccess: (data) => { - if (data.updateRequired) { - const storeUrl = - os === 'ios' - ? `https://apps.apple.com/app/id${data.appId}` - : `https://play.google.com/store/apps/details?id=${data.appId}` - Alert.alert(t('update.alert_title'), t('update.alert_message'), [ - { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, - ]) - } - }, - onError: (error) => { - console.error('Error checking for updates:', error) - Alert.alert(t('update.error_title'), t('update.error_message')) - }, - } - ) - } - }, [os, currentVersion, checkForUpdate, t]) - const renderItem: ListRenderItem = useCallback(({ item: { id, title } }) => { return ( From c0df1e55efff63c7bd5b48c00bda89d2560e7fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 20 May 2024 09:03:17 +0200 Subject: [PATCH 06/11] code optimizations --- src/components/AppLoading.tsx | 50 ++++--------------------------- src/hooks/useCheckForAppUpdate.ts | 50 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 44 deletions(-) create mode 100644 src/hooks/useCheckForAppUpdate.ts diff --git a/src/components/AppLoading.tsx b/src/components/AppLoading.tsx index 076aeaa3..33526997 100644 --- a/src/components/AppLoading.tsx +++ b/src/components/AppLoading.tsx @@ -1,67 +1,29 @@ -import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' import { Loader, Center } from '@baca/design-system/components' -import { useCachedResources, useNavigationTheme, useTranslation } from '@baca/hooks' +import { useCachedResources, useNavigationTheme } from '@baca/hooks' +import { useCheckForAppUpdate } from '@baca/hooks/useCheckForAppUpdate' import { isSignedInAtom } from '@baca/store/auth' -import * as Application from 'expo-application' import * as SplashScreen from 'expo-splash-screen' import { useAtomValue } from 'jotai' import { FC, PropsWithChildren, useCallback, useEffect, useState } from 'react' -import { View, StyleSheet, Alert, Platform, Linking } from 'react-native' +import { View, StyleSheet } from 'react-native' // Keep the splash screen visible while we fetch resources SplashScreen.preventAutoHideAsync() export const AppLoading: FC = ({ children }) => { const { navigationTheme } = useNavigationTheme() - const { t } = useTranslation() - const isLoadingComplete = useCachedResources() - const isSignedIn = useAtomValue(isSignedInAtom) - const [isLayoutReady, setIsLayoutReady] = useState(false) + const [isLayoutReady, setIsLayoutReady] = useState(false) const [isSplashHidden, setIsSplashHidden] = useState(false) + const isUpdateLoading = useCheckForAppUpdate() const onLayout = useCallback(() => { setIsLayoutReady(true) }, []) - const isLoading = !isLoadingComplete || isSignedIn === null || !isLayoutReady - - const currentVersion = Application.nativeApplicationVersion || 'unknown' - const os = Platform.OS - - const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() - - useEffect(() => { - if (os === 'ios' || os === 'android') { - checkForUpdate( - { - data: { - currentVersion, - os, - }, - }, - { - onSuccess: (data) => { - if (data.updateRequired) { - const storeUrl = - os === 'ios' - ? `https://apps.apple.com/app/id${data.appId}` - : `https://play.google.com/store/apps/details?id=${data.appId}` - Alert.alert(t('update.alert_title'), t('update.alert_message'), [ - { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, - ]) - } - }, - onError: (error) => { - console.error('Error checking for updates:', error) - // CONFIG: Add log to your analytics service, for example - sentry or crashlytics - }, - } - ) - } - }, [os, currentVersion, checkForUpdate, t]) + const isLoading = !isLoadingComplete || isSignedIn === null || !isLayoutReady || isUpdateLoading useEffect(() => { const hideSplashScreen = () => { diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts new file mode 100644 index 00000000..ce3f43e5 --- /dev/null +++ b/src/hooks/useCheckForAppUpdate.ts @@ -0,0 +1,50 @@ +import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' +import { useTranslation } from '@baca/hooks' +import * as Application from 'expo-application' +import { useEffect, useState } from 'react' +import { Platform, Alert, Linking } from 'react-native' + +export const useCheckForAppUpdate = () => { + const { t } = useTranslation() + const currentVersion = Application.nativeApplicationVersion || 'unknown' + const os = Platform.OS + const APP_STORE_URL = `https://apps.apple.com/app/id` + const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` + const [isUpdateLoading, setIsUpdateLoading] = useState(true) + + const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() + + useEffect(() => { + if (os === 'ios' || os === 'android') { + checkForUpdate( + { + data: { + currentVersion, + os, + }, + }, + { + onSuccess: ({ updateRequired, appId }) => { + if (updateRequired) { + const storeUrl = + os === 'ios' ? `${APP_STORE_URL}${appId}` : `${PLAY_STORE_URL}${appId}` + Alert.alert(t('update.alert_title'), t('update.alert_message'), [ + { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, + ]) + } + setIsUpdateLoading(false) + }, + onError: (error) => { + console.error('Error checking for updates:', error) + // CONFIG: Add log to your analytics service, for example - sentry o crashlytics + setIsUpdateLoading(false) + }, + } + ) + } else { + setIsUpdateLoading(false) + } + }, [os, currentVersion, checkForUpdate, t]) + + return isUpdateLoading +} From 34626c90e6bfbf8ea809667ac7b015f5eb539ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 20 May 2024 10:39:39 +0200 Subject: [PATCH 07/11] os destructured --- src/hooks/useCheckForAppUpdate.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts index ce3f43e5..38b3984d 100644 --- a/src/hooks/useCheckForAppUpdate.ts +++ b/src/hooks/useCheckForAppUpdate.ts @@ -7,7 +7,7 @@ import { Platform, Alert, Linking } from 'react-native' export const useCheckForAppUpdate = () => { const { t } = useTranslation() const currentVersion = Application.nativeApplicationVersion || 'unknown' - const os = Platform.OS + const { OS } = Platform const APP_STORE_URL = `https://apps.apple.com/app/id` const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` const [isUpdateLoading, setIsUpdateLoading] = useState(true) @@ -15,19 +15,19 @@ export const useCheckForAppUpdate = () => { const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() useEffect(() => { - if (os === 'ios' || os === 'android') { + if (OS === 'ios' || OS === 'android') { checkForUpdate( { data: { currentVersion, - os, + os: OS, }, }, { onSuccess: ({ updateRequired, appId }) => { if (updateRequired) { const storeUrl = - os === 'ios' ? `${APP_STORE_URL}${appId}` : `${PLAY_STORE_URL}${appId}` + OS === 'ios' ? `${APP_STORE_URL}${appId}` : `${PLAY_STORE_URL}${appId}` Alert.alert(t('update.alert_title'), t('update.alert_message'), [ { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, ]) @@ -44,7 +44,7 @@ export const useCheckForAppUpdate = () => { } else { setIsUpdateLoading(false) } - }, [os, currentVersion, checkForUpdate, t]) + }, [OS, currentVersion, checkForUpdate, t]) return isUpdateLoading } From 49d62d568c76697c485c18f51fda69bc2fbefcef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 20 May 2024 10:48:59 +0200 Subject: [PATCH 08/11] consts moved to useEffect --- src/hooks/useCheckForAppUpdate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts index 38b3984d..543f59e0 100644 --- a/src/hooks/useCheckForAppUpdate.ts +++ b/src/hooks/useCheckForAppUpdate.ts @@ -8,13 +8,13 @@ export const useCheckForAppUpdate = () => { const { t } = useTranslation() const currentVersion = Application.nativeApplicationVersion || 'unknown' const { OS } = Platform - const APP_STORE_URL = `https://apps.apple.com/app/id` - const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` const [isUpdateLoading, setIsUpdateLoading] = useState(true) const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() useEffect(() => { + const APP_STORE_URL = `https://apps.apple.com/app/id` + const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` if (OS === 'ios' || OS === 'android') { checkForUpdate( { From ae635fb733dafc80212680d70cedff11f0f9decc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 20 May 2024 12:33:48 +0200 Subject: [PATCH 09/11] onSettled included --- scripts/cli/constants.ts | 2 ++ src/hooks/useCheckForAppUpdate.ts | 11 ++++++----- src/i18n/translations/en.json | 4 +--- src/i18n/translations/pl.json | 6 ++---- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/cli/constants.ts b/scripts/cli/constants.ts index 7b35d2f6..08dc37a9 100644 --- a/scripts/cli/constants.ts +++ b/scripts/cli/constants.ts @@ -1,5 +1,7 @@ export const CLI_ACTIONS = ['generate', 'g', 'bootstrap', 'b'] +export const APP_STORE_URL = `https://apps.apple.com/app/id` +export const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` export const APP_ROUTER_DIRECTORY = 'app/(app)' export const SCREENS_DIRECTORY = 'src/screens' diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts index 543f59e0..119b6986 100644 --- a/src/hooks/useCheckForAppUpdate.ts +++ b/src/hooks/useCheckForAppUpdate.ts @@ -3,18 +3,18 @@ import { useTranslation } from '@baca/hooks' import * as Application from 'expo-application' import { useEffect, useState } from 'react' import { Platform, Alert, Linking } from 'react-native' +import { APP_STORE_URL, PLAY_STORE_URL } from 'scripts/cli/constants' + +const currentVersion = Application.nativeApplicationVersion || 'unknown' +const { OS } = Platform export const useCheckForAppUpdate = () => { const { t } = useTranslation() - const currentVersion = Application.nativeApplicationVersion || 'unknown' - const { OS } = Platform const [isUpdateLoading, setIsUpdateLoading] = useState(true) const { mutate: checkForUpdate } = useSystemControllerCheckForAppUpdate() useEffect(() => { - const APP_STORE_URL = `https://apps.apple.com/app/id` - const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` if (OS === 'ios' || OS === 'android') { checkForUpdate( { @@ -32,11 +32,12 @@ export const useCheckForAppUpdate = () => { { text: t('update.update_now'), onPress: () => Linking.openURL(storeUrl) }, ]) } - setIsUpdateLoading(false) }, onError: (error) => { console.error('Error checking for updates:', error) // CONFIG: Add log to your analytics service, for example - sentry o crashlytics + }, + onSettled: () => { setIsUpdateLoading(false) }, } diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index a4411fd2..e2e0dbf9 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -123,9 +123,7 @@ "alert_message": "You will have to restart the application to have better experiences while using it", "alert_title": "New version available", "restart": "Restart", - "update_now": "Update now", - "error_title": "Error", - "error_message": "An error occurred. Please try again later." + "update_now": "Update now" }, "application_info_screen": { "navigation_info": "When you will try to go back it will double ask if you really want to leave \n" diff --git a/src/i18n/translations/pl.json b/src/i18n/translations/pl.json index 64735374..9317e13b 100644 --- a/src/i18n/translations/pl.json +++ b/src/i18n/translations/pl.json @@ -120,12 +120,10 @@ "warning": {} }, "update": { - "alert_message": "Będziesz musiał zrestartować aplikację, żeby mieć lepsze doświadczenia podczas jej używania", + "alert_message": "Musisz zrestartować aplikację, żeby mieć lepsze doświadczenia podczas jej używania", "alert_title": "Aktualizacja", "restart": "Zrestartuj", - "update_now": "Aktualizuj teraz", - "error_title": "Błąd", - "error_message": "Wystąpił błąd. Proszę spróbuj ponownie później." + "update_now": "Aktualizuj teraz" }, "application_info_screen": { "navigation_info": "Kiedy będziesz próbował cofnąć to zostaniesz podwójnie zapytany, czy na pewno tego chcesz \n" From 41e836398ed6cd3e2f96fa66d7ff31c30abb3566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Mon, 20 May 2024 13:52:38 +0200 Subject: [PATCH 10/11] useEffect w/o OS and currentVersion --- src/hooks/useCheckForAppUpdate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts index 119b6986..5c6567d6 100644 --- a/src/hooks/useCheckForAppUpdate.ts +++ b/src/hooks/useCheckForAppUpdate.ts @@ -45,7 +45,7 @@ export const useCheckForAppUpdate = () => { } else { setIsUpdateLoading(false) } - }, [OS, currentVersion, checkForUpdate, t]) + }, [checkForUpdate, t]) return isUpdateLoading } From 2ac17aef6bb51acdf878af230b485d93563c6615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olaf=20Chwo=C5=82ka?= Date: Tue, 21 May 2024 23:50:22 +0200 Subject: [PATCH 11/11] consts moved to new file --- scripts/cli/constants.ts | 2 -- src/constants/links.ts | 2 ++ src/hooks/useCheckForAppUpdate.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/constants/links.ts diff --git a/scripts/cli/constants.ts b/scripts/cli/constants.ts index 08dc37a9..7b35d2f6 100644 --- a/scripts/cli/constants.ts +++ b/scripts/cli/constants.ts @@ -1,7 +1,5 @@ export const CLI_ACTIONS = ['generate', 'g', 'bootstrap', 'b'] -export const APP_STORE_URL = `https://apps.apple.com/app/id` -export const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` export const APP_ROUTER_DIRECTORY = 'app/(app)' export const SCREENS_DIRECTORY = 'src/screens' diff --git a/src/constants/links.ts b/src/constants/links.ts new file mode 100644 index 00000000..9a2c87f7 --- /dev/null +++ b/src/constants/links.ts @@ -0,0 +1,2 @@ +export const APP_STORE_URL = `https://apps.apple.com/app/id` +export const PLAY_STORE_URL = `https://play.google.com/store/apps/details?id=` diff --git a/src/hooks/useCheckForAppUpdate.ts b/src/hooks/useCheckForAppUpdate.ts index 5c6567d6..743d72b1 100644 --- a/src/hooks/useCheckForAppUpdate.ts +++ b/src/hooks/useCheckForAppUpdate.ts @@ -1,9 +1,9 @@ import { useSystemControllerCheckForAppUpdate } from '@baca/api/query/system/system' +import { APP_STORE_URL, PLAY_STORE_URL } from '@baca/constants/links' import { useTranslation } from '@baca/hooks' import * as Application from 'expo-application' import { useEffect, useState } from 'react' import { Platform, Alert, Linking } from 'react-native' -import { APP_STORE_URL, PLAY_STORE_URL } from 'scripts/cli/constants' const currentVersion = Application.nativeApplicationVersion || 'unknown' const { OS } = Platform