arkos 1.2.13-test.1 → 1.2.13-test.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app.js +1 -138
- package/dist/cjs/exports/auth/index.js +1 -6
- package/dist/cjs/exports/controllers/index.js +1 -11
- package/dist/cjs/exports/error-handler/index.js +1 -11
- package/dist/cjs/exports/index.js +1 -12
- package/dist/cjs/exports/middlewares/index.js +1 -7
- package/dist/cjs/exports/prisma/index.js +1 -6
- package/dist/cjs/exports/services/index.js +1 -49
- package/dist/cjs/exports/utils/index.js +1 -44
- package/dist/cjs/exports/validation/index.js +1 -11
- package/dist/cjs/modules/auth/auth.controller.js +1 -194
- package/dist/cjs/modules/auth/auth.router.js +1 -50
- package/dist/cjs/modules/auth/auth.service.js +1 -185
- package/dist/cjs/modules/auth/utils/helpers/auth.controller.helpers.js +1 -83
- package/dist/cjs/modules/base/base.controller.js +1 -158
- package/dist/cjs/modules/base/base.middlewares.js +1 -92
- package/dist/cjs/modules/base/base.router.js +1 -24
- package/dist/cjs/modules/base/base.service.js +1 -128
- package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js +1 -82
- package/dist/cjs/modules/base/utils/helpers/base.middlewares.helpers.js +1 -50
- package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +1 -97
- package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js +1 -171
- package/dist/cjs/modules/email/email.service.js +1 -104
- package/dist/cjs/modules/error-handler/error-handler.controller.js +4 -146
- package/dist/cjs/modules/error-handler/utils/app-error.js +1 -17
- package/dist/cjs/modules/error-handler/utils/catch-async.js +1 -12
- package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +3 -201
- package/dist/cjs/modules/file-upload/file-upload.controller.js +1 -271
- package/dist/cjs/modules/file-upload/file-upload.router.js +1 -44
- package/dist/cjs/modules/file-upload/file-upload.service.js +1 -322
- package/dist/cjs/modules/file-upload/utils/helpers/file-upload.helpers.js +1 -97
- package/dist/cjs/modules/swagger/swagger.router.js +1 -119
- package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +1 -270
- package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js +1 -66
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +1 -41
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +1 -29
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js +1 -30
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js +1 -471
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js +1 -575
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +1 -253
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +1 -105
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/paths.js +1 -9
- package/dist/cjs/server.js +5 -85
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types/arkos-config.js +1 -3
- package/dist/cjs/types/auth.js +1 -3
- package/dist/cjs/types/index.js +1 -11
- package/dist/cjs/types/router-config.js +1 -3
- package/dist/cjs/utils/arkos-env.js +1 -9
- package/dist/cjs/utils/cli/build.js +6 -212
- package/dist/cjs/utils/cli/dev.js +5 -256
- package/dist/cjs/utils/cli/dev.js.map +1 -1
- package/dist/cjs/utils/cli/generate.js +12 -189
- package/dist/cjs/utils/cli/index.js +1 -81
- package/dist/cjs/utils/cli/start.js +5 -94
- package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -24
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +5 -20
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-controller-template.js +6 -15
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-middlewares.js +38 -67
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +8 -36
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-router-template.js +11 -36
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-service-template.js +7 -27
- package/dist/cjs/utils/cli/utils/template-generators.js +2 -28
- package/dist/cjs/utils/dotenv.helpers.js +1 -43
- package/dist/cjs/utils/features/api.features.js +1 -167
- package/dist/cjs/utils/features/change-case.features.js +1 -67
- package/dist/cjs/utils/helpers/api.features.helpers.js +1 -106
- package/dist/cjs/utils/helpers/change-case.helpers.js +1 -177
- package/dist/cjs/utils/helpers/deepmerge.helper.js +1 -115
- package/dist/cjs/utils/helpers/fs.helpers.js +1 -61
- package/dist/cjs/utils/helpers/global.helpers.js +1 -89
- package/dist/cjs/utils/helpers/models.helpers.js +11 -339
- package/dist/cjs/utils/helpers/prisma.helpers.js +1 -52
- package/dist/cjs/utils/helpers/query-parser.helpers.js +1 -45
- package/dist/cjs/utils/helpers/routers.helpers.js +1 -21
- package/dist/cjs/utils/helpers/text.helpers.js +1 -28
- package/dist/cjs/utils/prisma/enhaced-prisma-json-schema-generator.js +1 -451
- package/dist/cjs/utils/prisma/enhaced-prisma-json-schema-generator.js.map +1 -1
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +1 -88
- package/dist/cjs/utils/prisma/prisma-schema-parser.js +3 -158
- package/dist/cjs/utils/prisma/types.js +1 -3
- package/dist/cjs/utils/sheu.js +1 -119
- package/dist/cjs/utils/validate-dto.js +1 -17
- package/dist/cjs/utils/validate-schema.js +1 -15
- package/dist/esm/app.js +1 -0
- package/dist/esm/app.js.map +1 -0
- package/dist/esm/exports/auth/index.js +1 -0
- package/dist/esm/exports/auth/index.js.map +1 -0
- package/dist/esm/exports/controllers/index.js +1 -0
- package/dist/esm/exports/controllers/index.js.map +1 -0
- package/dist/esm/exports/error-handler/index.js +1 -0
- package/dist/esm/exports/error-handler/index.js.map +1 -0
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/exports/index.js.map +1 -0
- package/dist/esm/exports/middlewares/index.js +1 -0
- package/dist/esm/exports/middlewares/index.js.map +1 -0
- package/dist/esm/exports/prisma/index.js +1 -0
- package/dist/esm/exports/prisma/index.js.map +1 -0
- package/dist/esm/exports/services/index.js +1 -0
- package/dist/esm/exports/services/index.js.map +1 -0
- package/dist/esm/exports/utils/index.js +1 -0
- package/dist/esm/exports/utils/index.js.map +1 -0
- package/dist/esm/exports/validation/index.js +1 -0
- package/dist/esm/exports/validation/index.js.map +1 -0
- package/dist/esm/modules/auth/auth.controller.js +1 -0
- package/dist/esm/modules/auth/auth.controller.js.map +1 -0
- package/dist/esm/modules/auth/auth.router.js +1 -0
- package/dist/esm/modules/auth/auth.router.js.map +1 -0
- package/dist/esm/modules/auth/auth.service.js +1 -0
- package/dist/esm/modules/auth/auth.service.js.map +1 -0
- package/dist/esm/modules/auth/utils/helpers/auth.controller.helpers.js +1 -0
- package/dist/esm/modules/auth/utils/helpers/auth.controller.helpers.js.map +1 -0
- package/dist/esm/modules/base/base.controller.js +1 -0
- package/dist/esm/modules/base/base.controller.js.map +1 -0
- package/dist/esm/modules/base/base.middlewares.js +1 -0
- package/dist/esm/modules/base/base.middlewares.js.map +1 -0
- package/dist/esm/modules/base/base.router.js +1 -0
- package/dist/esm/modules/base/base.router.js.map +1 -0
- package/dist/esm/modules/base/base.service.js +1 -0
- package/dist/esm/modules/base/base.service.js.map +1 -0
- package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js +1 -0
- package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js.map +1 -0
- package/dist/esm/modules/base/utils/helpers/base.middlewares.helpers.js +1 -0
- package/dist/esm/modules/base/utils/helpers/base.middlewares.helpers.js.map +1 -0
- package/dist/esm/modules/base/utils/helpers/base.router.helpers.js +1 -0
- package/dist/esm/modules/base/utils/helpers/base.router.helpers.js.map +1 -0
- package/dist/esm/modules/base/utils/helpers/base.service.helpers.js +1 -0
- package/dist/esm/modules/base/utils/helpers/base.service.helpers.js.map +1 -0
- package/dist/esm/modules/email/email.service.js +1 -0
- package/dist/esm/modules/email/email.service.js.map +1 -0
- package/dist/esm/modules/error-handler/error-handler.controller.js +4 -0
- package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -0
- package/dist/esm/modules/error-handler/utils/app-error.js +1 -0
- package/dist/esm/modules/error-handler/utils/app-error.js.map +1 -0
- package/dist/esm/modules/error-handler/utils/catch-async.js +1 -0
- package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -0
- package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +3 -0
- package/dist/esm/modules/error-handler/utils/error-handler.helpers.js.map +1 -0
- package/dist/esm/modules/file-upload/file-upload.controller.js +1 -0
- package/dist/esm/modules/file-upload/file-upload.controller.js.map +1 -0
- package/dist/esm/modules/file-upload/file-upload.router.js +1 -0
- package/dist/esm/modules/file-upload/file-upload.router.js.map +1 -0
- package/dist/esm/modules/file-upload/file-upload.service.js +1 -0
- package/dist/esm/modules/file-upload/file-upload.service.js.map +1 -0
- package/dist/esm/modules/file-upload/utils/helpers/file-upload.helpers.js +1 -0
- package/dist/esm/modules/file-upload/utils/helpers/file-upload.helpers.js.map +1 -0
- package/dist/esm/modules/swagger/swagger.router.js +1 -0
- package/dist/esm/modules/swagger/swagger.router.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +1 -0
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/paths.js +1 -0
- package/dist/esm/paths.js.map +1 -0
- package/dist/esm/server.js +5 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/esm/types/arkos-config.js +1 -0
- package/dist/esm/types/arkos-config.js.map +1 -0
- package/dist/esm/types/auth.js +1 -0
- package/dist/esm/types/auth.js.map +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/router-config.js +1 -0
- package/dist/esm/types/router-config.js.map +1 -0
- package/dist/esm/utils/arkos-env.js +1 -0
- package/dist/esm/utils/arkos-env.js.map +1 -0
- package/dist/esm/utils/cli/build.js +6 -0
- package/dist/esm/utils/cli/build.js.map +1 -0
- package/dist/esm/utils/cli/dev.js +5 -0
- package/dist/esm/utils/cli/dev.js.map +1 -0
- package/dist/esm/utils/cli/generate.js +12 -0
- package/dist/esm/utils/cli/generate.js.map +1 -0
- package/dist/esm/utils/cli/index.js +1 -0
- package/dist/esm/utils/cli/index.js.map +1 -0
- package/dist/esm/utils/cli/start.js +5 -0
- package/dist/esm/utils/cli/start.js.map +1 -0
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -0
- package/dist/esm/utils/cli/utils/cli.helpers.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +21 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js +12 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-middlewares.js +206 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-middlewares.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +36 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-router-template.js +18 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-router-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-service-template.js +15 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-service-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generators.js +2 -0
- package/dist/esm/utils/cli/utils/template-generators.js.map +1 -0
- package/dist/esm/utils/dotenv.helpers.js +1 -0
- package/dist/esm/utils/dotenv.helpers.js.map +1 -0
- package/dist/esm/utils/features/api.features.js +1 -0
- package/dist/esm/utils/features/api.features.js.map +1 -0
- package/dist/esm/utils/features/change-case.features.js +1 -0
- package/dist/esm/utils/features/change-case.features.js.map +1 -0
- package/dist/esm/utils/helpers/api.features.helpers.js +1 -0
- package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/change-case.helpers.js +1 -0
- package/dist/esm/utils/helpers/change-case.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/deepmerge.helper.js +1 -0
- package/dist/esm/utils/helpers/deepmerge.helper.js.map +1 -0
- package/dist/esm/utils/helpers/fs.helpers.js +1 -0
- package/dist/esm/utils/helpers/fs.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/global.helpers.js +1 -0
- package/dist/esm/utils/helpers/global.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/models.helpers.js +11 -0
- package/dist/esm/utils/helpers/models.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/prisma.helpers.js +1 -0
- package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/query-parser.helpers.js +1 -0
- package/dist/esm/utils/helpers/query-parser.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/routers.helpers.js +1 -0
- package/dist/esm/utils/helpers/routers.helpers.js.map +1 -0
- package/dist/esm/utils/helpers/text.helpers.js +1 -0
- package/dist/esm/utils/helpers/text.helpers.js.map +1 -0
- package/dist/esm/utils/prisma/enhaced-prisma-json-schema-generator.js +1 -0
- package/dist/esm/utils/prisma/enhaced-prisma-json-schema-generator.js.map +1 -0
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js +1 -0
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -0
- package/dist/esm/utils/prisma/prisma-schema-parser.js +3 -0
- package/dist/esm/utils/prisma/prisma-schema-parser.js.map +1 -0
- package/dist/esm/utils/prisma/types.js +1 -0
- package/dist/esm/utils/prisma/types.js.map +1 -0
- package/dist/esm/utils/sheu.js +1 -0
- package/dist/esm/utils/sheu.js.map +1 -0
- package/dist/esm/utils/validate-dto.js +1 -0
- package/dist/esm/utils/validate-dto.js.map +1 -0
- package/dist/esm/utils/validate-schema.js +1 -0
- package/dist/esm/utils/validate-schema.js.map +1 -0
- package/package.json +6 -4
- package/dist/cjs/index.js +0 -22
- package/dist/esm/index.d.mts +0 -280
- package/dist/esm/index.mjs +0 -22
- package/dist/exports/index.js +0 -1
- package/dist/types/arkos-config.js +0 -1
- package/dist/types/auth.js +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/router-config.js +0 -1
- package/dist/utils/arkos-env.js +0 -1
- package/dist/utils/dotenv.helpers.js +0 -1
- package/dist/utils/sheu.js +0 -1
- package/dist/utils/validate-dto.js +0 -1
- package/dist/utils/validate-schema.js +0 -1
|
@@ -1,575 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generatePrismaModelParentRoutePaths = generatePrismaModelParentRoutePaths;
|
|
7
|
-
const pluralize_1 = __importDefault(require("pluralize"));
|
|
8
|
-
const utils_1 = require("../../../../../../exports/utils");
|
|
9
|
-
const swagger_router_helpers_1 = require("../../swagger.router.helpers");
|
|
10
|
-
const models_helpers_1 = require("../../../../../../utils/helpers/models.helpers");
|
|
11
|
-
const models_helpers_2 = require("../../../../../../utils/helpers/models.helpers");
|
|
12
|
-
async function generatePrismaModelParentRoutePaths(model, paths, arkosConfig) {
|
|
13
|
-
const modelName = (0, utils_1.kebabCase)(model);
|
|
14
|
-
const routeName = pluralize_1.default.plural(modelName);
|
|
15
|
-
const pascalModelName = (0, utils_1.pascalCase)(model);
|
|
16
|
-
const humanReadableName = (0, swagger_router_helpers_1.kebabToHuman)(modelName);
|
|
17
|
-
const humanReadableNamePlural = pluralize_1.default.plural(humanReadableName);
|
|
18
|
-
const modelModules = await (0, models_helpers_1.importPrismaModelModules)(model, arkosConfig);
|
|
19
|
-
const routerConfig = modelModules?.router?.config;
|
|
20
|
-
if (routerConfig?.disable === true)
|
|
21
|
-
return;
|
|
22
|
-
if (!routerConfig?.parent)
|
|
23
|
-
return;
|
|
24
|
-
const parentModel = routerConfig.parent.model;
|
|
25
|
-
const parentRouteName = pluralize_1.default.plural((0, utils_1.kebabCase)(parentModel));
|
|
26
|
-
const parentHumanName = (0, swagger_router_helpers_1.kebabToHuman)((0, utils_1.kebabCase)(parentModel));
|
|
27
|
-
const isParentEndpointAllowed = (endpoint) => {
|
|
28
|
-
const parentEndpoints = routerConfig?.parent?.endpoints;
|
|
29
|
-
if (!parentEndpoints || parentEndpoints === "*") {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
if (Array.isArray(parentEndpoints)) {
|
|
33
|
-
return parentEndpoints.includes(endpoint);
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
};
|
|
37
|
-
const getSchemaMode = async (action) => {
|
|
38
|
-
const swaggerMode = arkosConfig.swagger?.mode;
|
|
39
|
-
const isStrict = arkosConfig.swagger?.strict;
|
|
40
|
-
if (isStrict) {
|
|
41
|
-
return swaggerMode || "prisma";
|
|
42
|
-
}
|
|
43
|
-
const actionKey = action;
|
|
44
|
-
const localFileExists = await (0, models_helpers_2.localValidatorFileExists)(actionKey, model, arkosConfig);
|
|
45
|
-
if (!localFileExists)
|
|
46
|
-
return "prisma";
|
|
47
|
-
return swaggerMode || "prisma";
|
|
48
|
-
};
|
|
49
|
-
if (isParentEndpointAllowed("createOne")) {
|
|
50
|
-
const createMode = await getSchemaMode("create");
|
|
51
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}`] = {
|
|
52
|
-
post: {
|
|
53
|
-
tags: [humanReadableNamePlural],
|
|
54
|
-
summary: `Create ${humanReadableName} for ${parentHumanName}`,
|
|
55
|
-
description: `Creates a new ${humanReadableName} record associated with the specified ${parentHumanName}`,
|
|
56
|
-
operationId: `create${pascalModelName}For${(0, utils_1.pascalCase)(parentModel)}`,
|
|
57
|
-
parameters: [
|
|
58
|
-
{
|
|
59
|
-
name: "id",
|
|
60
|
-
in: "path",
|
|
61
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
62
|
-
required: true,
|
|
63
|
-
schema: {
|
|
64
|
-
type: "string",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
requestBody: {
|
|
69
|
-
description: `${humanReadableName} data to create`,
|
|
70
|
-
required: true,
|
|
71
|
-
content: {
|
|
72
|
-
"application/json": {
|
|
73
|
-
schema: {
|
|
74
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`Create${pascalModelName}`, createMode),
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
responses: {
|
|
80
|
-
"201": {
|
|
81
|
-
description: `${humanReadableName} created successfully`,
|
|
82
|
-
content: {
|
|
83
|
-
"application/json": {
|
|
84
|
-
schema: {
|
|
85
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`${pascalModelName}`, createMode),
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
"400": {
|
|
91
|
-
description: "Invalid input data provided",
|
|
92
|
-
},
|
|
93
|
-
"401": {
|
|
94
|
-
description: "Authentication required",
|
|
95
|
-
},
|
|
96
|
-
"403": {
|
|
97
|
-
description: "Insufficient permissions",
|
|
98
|
-
},
|
|
99
|
-
"404": {
|
|
100
|
-
description: `${parentHumanName} not found`,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
security: [{ BearerAuth: [] }],
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (isParentEndpointAllowed("findMany")) {
|
|
108
|
-
if (!paths[`/api/${parentRouteName}/{id}/${routeName}`])
|
|
109
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}`] = {};
|
|
110
|
-
const findManyMode = await getSchemaMode("findMany");
|
|
111
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}`].get = {
|
|
112
|
-
tags: [humanReadableNamePlural],
|
|
113
|
-
summary: `Get ${humanReadableNamePlural} for ${parentHumanName}`,
|
|
114
|
-
description: `Retrieves all ${humanReadableNamePlural} associated with the specified ${parentHumanName}`,
|
|
115
|
-
operationId: `get${pluralize_1.default.plural(pascalModelName)}For${(0, utils_1.pascalCase)(parentModel)}`,
|
|
116
|
-
parameters: [
|
|
117
|
-
{
|
|
118
|
-
name: "id",
|
|
119
|
-
in: "path",
|
|
120
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
121
|
-
required: true,
|
|
122
|
-
schema: {
|
|
123
|
-
type: "string",
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "filter",
|
|
128
|
-
in: "query",
|
|
129
|
-
description: "Additional filter criteria in JSON format",
|
|
130
|
-
schema: {
|
|
131
|
-
type: "string",
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: "sort",
|
|
136
|
-
in: "query",
|
|
137
|
-
description: "Sort field (prefix with '-' for descending order)",
|
|
138
|
-
schema: {
|
|
139
|
-
type: "string",
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "page",
|
|
144
|
-
in: "query",
|
|
145
|
-
description: "Page number (starts from 1)",
|
|
146
|
-
schema: {
|
|
147
|
-
type: "integer",
|
|
148
|
-
minimum: 1,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: "limit",
|
|
153
|
-
in: "query",
|
|
154
|
-
description: "Number of items per page",
|
|
155
|
-
schema: {
|
|
156
|
-
type: "integer",
|
|
157
|
-
minimum: 1,
|
|
158
|
-
maximum: 100,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: "fields",
|
|
163
|
-
in: "query",
|
|
164
|
-
description: "Comma-separated list of fields to include in response",
|
|
165
|
-
schema: {
|
|
166
|
-
type: "string",
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
responses: {
|
|
171
|
-
"200": {
|
|
172
|
-
description: `List of ${humanReadableNamePlural} retrieved successfully`,
|
|
173
|
-
content: {
|
|
174
|
-
"application/json": {
|
|
175
|
-
schema: {
|
|
176
|
-
type: "object",
|
|
177
|
-
properties: {
|
|
178
|
-
total: {
|
|
179
|
-
type: "integer",
|
|
180
|
-
description: "Total number of records matching the criteria",
|
|
181
|
-
},
|
|
182
|
-
results: {
|
|
183
|
-
type: "integer",
|
|
184
|
-
description: "Number of records returned in current page",
|
|
185
|
-
},
|
|
186
|
-
data: {
|
|
187
|
-
type: "array",
|
|
188
|
-
items: {
|
|
189
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`FindMany${pascalModelName}`, findManyMode),
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
"401": {
|
|
198
|
-
description: "Authentication required",
|
|
199
|
-
},
|
|
200
|
-
"403": {
|
|
201
|
-
description: "Insufficient permissions",
|
|
202
|
-
},
|
|
203
|
-
"404": {
|
|
204
|
-
description: `${parentHumanName} not found`,
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
security: [{ BearerAuth: [] }],
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
if (isParentEndpointAllowed("createMany")) {
|
|
211
|
-
const createManyMode = await getSchemaMode("createMany");
|
|
212
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/many`] = {
|
|
213
|
-
post: {
|
|
214
|
-
tags: [humanReadableNamePlural],
|
|
215
|
-
summary: `Create multiple ${humanReadableNamePlural} for ${parentHumanName}`,
|
|
216
|
-
description: `Creates multiple ${humanReadableNamePlural} records associated with the specified ${parentHumanName}`,
|
|
217
|
-
operationId: `createMany${pascalModelName}For${(0, utils_1.pascalCase)(parentModel)}`,
|
|
218
|
-
parameters: [
|
|
219
|
-
{
|
|
220
|
-
name: "id",
|
|
221
|
-
in: "path",
|
|
222
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
223
|
-
required: true,
|
|
224
|
-
schema: {
|
|
225
|
-
type: "string",
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
requestBody: {
|
|
230
|
-
description: `Array of ${humanReadableName} data to create`,
|
|
231
|
-
required: true,
|
|
232
|
-
content: {
|
|
233
|
-
"application/json": {
|
|
234
|
-
schema: {
|
|
235
|
-
type: "array",
|
|
236
|
-
items: {
|
|
237
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`CreateMany${pascalModelName}`, createManyMode),
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
responses: {
|
|
244
|
-
"201": {
|
|
245
|
-
description: `${humanReadableNamePlural} created successfully`,
|
|
246
|
-
content: {
|
|
247
|
-
"application/json": {
|
|
248
|
-
schema: {
|
|
249
|
-
type: "object",
|
|
250
|
-
properties: {
|
|
251
|
-
count: {
|
|
252
|
-
type: "integer",
|
|
253
|
-
description: "Number of records created",
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
"400": {
|
|
261
|
-
description: "Invalid input data provided",
|
|
262
|
-
},
|
|
263
|
-
"401": {
|
|
264
|
-
description: "Authentication required",
|
|
265
|
-
},
|
|
266
|
-
"403": {
|
|
267
|
-
description: "Insufficient permissions",
|
|
268
|
-
},
|
|
269
|
-
"404": {
|
|
270
|
-
description: `${parentHumanName} not found`,
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
security: [{ BearerAuth: [] }],
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
if (isParentEndpointAllowed("updateMany")) {
|
|
278
|
-
if (!paths[`/api/${parentRouteName}/{id}/${routeName}/many`])
|
|
279
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/many`] = {};
|
|
280
|
-
const updateManyMode = await getSchemaMode("updateMany");
|
|
281
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/many`].patch = {
|
|
282
|
-
tags: [humanReadableNamePlural],
|
|
283
|
-
summary: `Update multiple ${humanReadableNamePlural} for ${parentHumanName}`,
|
|
284
|
-
description: `Updates multiple ${humanReadableNamePlural} records associated with the specified ${parentHumanName}`,
|
|
285
|
-
operationId: `updateMany${pascalModelName}For${(0, utils_1.pascalCase)(parentModel)}`,
|
|
286
|
-
parameters: [
|
|
287
|
-
{
|
|
288
|
-
name: "id",
|
|
289
|
-
in: "path",
|
|
290
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
291
|
-
required: true,
|
|
292
|
-
schema: {
|
|
293
|
-
type: "string",
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
name: "filter",
|
|
298
|
-
in: "query",
|
|
299
|
-
description: "Additional filter criteria in JSON format",
|
|
300
|
-
schema: {
|
|
301
|
-
type: "string",
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
],
|
|
305
|
-
requestBody: {
|
|
306
|
-
description: `Partial ${humanReadableName} data to update`,
|
|
307
|
-
required: true,
|
|
308
|
-
content: {
|
|
309
|
-
"application/json": {
|
|
310
|
-
schema: {
|
|
311
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`UpdateMany${pascalModelName}`, updateManyMode),
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
responses: {
|
|
317
|
-
"200": {
|
|
318
|
-
description: `${humanReadableNamePlural} updated successfully`,
|
|
319
|
-
content: {
|
|
320
|
-
"application/json": {
|
|
321
|
-
schema: {
|
|
322
|
-
type: "object",
|
|
323
|
-
properties: {
|
|
324
|
-
count: {
|
|
325
|
-
type: "integer",
|
|
326
|
-
description: "Number of records updated",
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
"400": {
|
|
334
|
-
description: "Invalid input data provided",
|
|
335
|
-
},
|
|
336
|
-
"401": {
|
|
337
|
-
description: "Authentication required",
|
|
338
|
-
},
|
|
339
|
-
"403": {
|
|
340
|
-
description: "Insufficient permissions",
|
|
341
|
-
},
|
|
342
|
-
"404": {
|
|
343
|
-
description: `${parentHumanName} not found`,
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
security: [{ BearerAuth: [] }],
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
if (isParentEndpointAllowed("deleteMany")) {
|
|
350
|
-
if (!paths[`/api/${parentRouteName}/{id}/${routeName}/many`])
|
|
351
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/many`] = {};
|
|
352
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/many`].delete = {
|
|
353
|
-
tags: [humanReadableNamePlural],
|
|
354
|
-
summary: `Delete multiple ${humanReadableNamePlural} for ${parentHumanName}`,
|
|
355
|
-
description: `Deletes multiple ${humanReadableNamePlural} records associated with the specified ${parentHumanName}`,
|
|
356
|
-
operationId: `deleteMany${pascalModelName}For${(0, utils_1.pascalCase)(parentModel)}`,
|
|
357
|
-
parameters: [
|
|
358
|
-
{
|
|
359
|
-
name: "id",
|
|
360
|
-
in: "path",
|
|
361
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
362
|
-
required: true,
|
|
363
|
-
schema: {
|
|
364
|
-
type: "string",
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: "filter",
|
|
369
|
-
in: "query",
|
|
370
|
-
description: "Additional filter criteria in JSON format",
|
|
371
|
-
schema: {
|
|
372
|
-
type: "string",
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
responses: {
|
|
377
|
-
"200": {
|
|
378
|
-
description: `${humanReadableNamePlural} deleted successfully`,
|
|
379
|
-
content: {
|
|
380
|
-
"application/json": {
|
|
381
|
-
schema: {
|
|
382
|
-
type: "object",
|
|
383
|
-
properties: {
|
|
384
|
-
count: {
|
|
385
|
-
type: "integer",
|
|
386
|
-
description: "Number of records deleted",
|
|
387
|
-
},
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
},
|
|
393
|
-
"400": {
|
|
394
|
-
description: "Missing filter criteria",
|
|
395
|
-
},
|
|
396
|
-
"401": {
|
|
397
|
-
description: "Authentication required",
|
|
398
|
-
},
|
|
399
|
-
"403": {
|
|
400
|
-
description: "Insufficient permissions",
|
|
401
|
-
},
|
|
402
|
-
"404": {
|
|
403
|
-
description: `${parentHumanName} not found`,
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
security: [{ BearerAuth: [] }],
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
if (isParentEndpointAllowed("findOne")) {
|
|
410
|
-
const findOneMode = await getSchemaMode("findOne");
|
|
411
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`] = {
|
|
412
|
-
get: {
|
|
413
|
-
tags: [humanReadableNamePlural],
|
|
414
|
-
summary: `Get ${humanReadableName} by ID for ${parentHumanName}`,
|
|
415
|
-
description: `Retrieves a single ${humanReadableName} record by its unique identifier associated with the specified ${parentHumanName}`,
|
|
416
|
-
operationId: `get${pascalModelName}ByIdFor${(0, utils_1.pascalCase)(parentModel)}`,
|
|
417
|
-
parameters: [
|
|
418
|
-
{
|
|
419
|
-
name: "id",
|
|
420
|
-
in: "path",
|
|
421
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
422
|
-
required: true,
|
|
423
|
-
schema: {
|
|
424
|
-
type: "string",
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: "childId",
|
|
429
|
-
in: "path",
|
|
430
|
-
description: `Unique identifier of the ${humanReadableName}`,
|
|
431
|
-
required: true,
|
|
432
|
-
schema: {
|
|
433
|
-
type: "string",
|
|
434
|
-
},
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
responses: {
|
|
438
|
-
"200": {
|
|
439
|
-
description: `${humanReadableName} retrieved successfully`,
|
|
440
|
-
content: {
|
|
441
|
-
"application/json": {
|
|
442
|
-
schema: {
|
|
443
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`FindOne${pascalModelName}`, findOneMode),
|
|
444
|
-
},
|
|
445
|
-
},
|
|
446
|
-
},
|
|
447
|
-
},
|
|
448
|
-
"401": {
|
|
449
|
-
description: "Authentication required",
|
|
450
|
-
},
|
|
451
|
-
"403": {
|
|
452
|
-
description: "Insufficient permissions",
|
|
453
|
-
},
|
|
454
|
-
"404": {
|
|
455
|
-
description: `${humanReadableName} or ${parentHumanName} not found`,
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
security: [{ BearerAuth: [] }],
|
|
459
|
-
},
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
if (isParentEndpointAllowed("updateOne")) {
|
|
463
|
-
if (!paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`])
|
|
464
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`] = {};
|
|
465
|
-
const updateMode = await getSchemaMode("update");
|
|
466
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`].patch = {
|
|
467
|
-
tags: [humanReadableNamePlural],
|
|
468
|
-
summary: `Update ${humanReadableName} by ID for ${parentHumanName}`,
|
|
469
|
-
description: `Updates a single ${humanReadableName} record by its unique identifier associated with the specified ${parentHumanName}`,
|
|
470
|
-
operationId: `update${pascalModelName}ByIdFor${(0, utils_1.pascalCase)(parentModel)}`,
|
|
471
|
-
parameters: [
|
|
472
|
-
{
|
|
473
|
-
name: "id",
|
|
474
|
-
in: "path",
|
|
475
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
476
|
-
required: true,
|
|
477
|
-
schema: {
|
|
478
|
-
type: "string",
|
|
479
|
-
},
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
name: "childId",
|
|
483
|
-
in: "path",
|
|
484
|
-
description: `Unique identifier of the ${humanReadableName}`,
|
|
485
|
-
required: true,
|
|
486
|
-
schema: {
|
|
487
|
-
type: "string",
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
],
|
|
491
|
-
requestBody: {
|
|
492
|
-
description: `Partial ${humanReadableName} data to update`,
|
|
493
|
-
required: true,
|
|
494
|
-
content: {
|
|
495
|
-
"application/json": {
|
|
496
|
-
schema: {
|
|
497
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`Update${pascalModelName}`, updateMode),
|
|
498
|
-
},
|
|
499
|
-
},
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
responses: {
|
|
503
|
-
"200": {
|
|
504
|
-
description: `${humanReadableName} updated successfully`,
|
|
505
|
-
content: {
|
|
506
|
-
"application/json": {
|
|
507
|
-
schema: {
|
|
508
|
-
$ref: (0, swagger_router_helpers_1.getSchemaRef)(`${pascalModelName}`, updateMode),
|
|
509
|
-
},
|
|
510
|
-
},
|
|
511
|
-
},
|
|
512
|
-
},
|
|
513
|
-
"400": {
|
|
514
|
-
description: "Invalid input data provided",
|
|
515
|
-
},
|
|
516
|
-
"401": {
|
|
517
|
-
description: "Authentication required",
|
|
518
|
-
},
|
|
519
|
-
"403": {
|
|
520
|
-
description: "Insufficient permissions",
|
|
521
|
-
},
|
|
522
|
-
"404": {
|
|
523
|
-
description: `${humanReadableName} or ${parentHumanName} not found`,
|
|
524
|
-
},
|
|
525
|
-
},
|
|
526
|
-
security: [{ BearerAuth: [] }],
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
if (isParentEndpointAllowed("deleteOne")) {
|
|
530
|
-
if (!paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`])
|
|
531
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`] = {};
|
|
532
|
-
paths[`/api/${parentRouteName}/{id}/${routeName}/{childId}`].delete = {
|
|
533
|
-
tags: [humanReadableNamePlural],
|
|
534
|
-
summary: `Delete ${humanReadableName} by ID for ${parentHumanName}`,
|
|
535
|
-
description: `Permanently deletes a single ${humanReadableName} record by its unique identifier associated with the specified ${parentHumanName}`,
|
|
536
|
-
operationId: `delete${pascalModelName}ByIdFor${(0, utils_1.pascalCase)(parentModel)}`,
|
|
537
|
-
parameters: [
|
|
538
|
-
{
|
|
539
|
-
name: "id",
|
|
540
|
-
in: "path",
|
|
541
|
-
description: `Unique identifier of the ${parentHumanName}`,
|
|
542
|
-
required: true,
|
|
543
|
-
schema: {
|
|
544
|
-
type: "string",
|
|
545
|
-
},
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
name: "childId",
|
|
549
|
-
in: "path",
|
|
550
|
-
description: `Unique identifier of the ${humanReadableName}`,
|
|
551
|
-
required: true,
|
|
552
|
-
schema: {
|
|
553
|
-
type: "string",
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
],
|
|
557
|
-
responses: {
|
|
558
|
-
"204": {
|
|
559
|
-
description: `${humanReadableName} deleted successfully`,
|
|
560
|
-
},
|
|
561
|
-
"401": {
|
|
562
|
-
description: "Authentication required",
|
|
563
|
-
},
|
|
564
|
-
"403": {
|
|
565
|
-
description: "Insufficient permissions",
|
|
566
|
-
},
|
|
567
|
-
"404": {
|
|
568
|
-
description: `${humanReadableName} or ${parentHumanName} not found`,
|
|
569
|
-
},
|
|
570
|
-
},
|
|
571
|
-
security: [{ BearerAuth: [] }],
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
//# sourceMappingURL=generate-prisma-model-parent-routes.js.map
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.generatePrismaModelParentRoutePaths=generatePrismaModelParentRoutePaths;const pluralize_1=__importDefault(require("pluralize")),utils_1=require("../../../../../../exports/utils"),swagger_router_helpers_1=require("../../swagger.router.helpers"),models_helpers_1=require("../../../../../../utils/helpers/models.helpers"),models_helpers_2=require("../../../../../../utils/helpers/models.helpers");async function generatePrismaModelParentRoutePaths(c,r,m){const $=(0,utils_1.kebabCase)(c),n=pluralize_1.default.plural($),o=(0,utils_1.pascalCase)(c),i=(0,swagger_router_helpers_1.kebabToHuman)($),t=pluralize_1.default.plural(i),f=(await(0,models_helpers_1.importPrismaModelModules)(c,m))?.router?.config;if(f?.disable===!0||!f?.parent)return;const d=f.parent.model,a=pluralize_1.default.plural((0,utils_1.kebabCase)(d)),e=(0,swagger_router_helpers_1.kebabToHuman)((0,utils_1.kebabCase)(d)),p=s=>{const u=f?.parent?.endpoints;return!u||u==="*"?!0:Array.isArray(u)?u.includes(s):!1},l=async s=>{const u=m.swagger?.mode;if(m.swagger?.strict)return u||"prisma";const y=s;return await(0,models_helpers_2.localValidatorFileExists)(y,c,m)&&u||"prisma"};if(p("createOne")){const s=await l("create");r[`/api/${a}/{id}/${n}`]={post:{tags:[t],summary:`Create ${i} for ${e}`,description:`Creates a new ${i} record associated with the specified ${e}`,operationId:`create${o}For${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}}],requestBody:{description:`${i} data to create`,required:!0,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`Create${o}`,s)}}}},responses:{201:{description:`${i} created successfully`,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`${o}`,s)}}}},400:{description:"Invalid input data provided"},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${e} not found`}},security:[{BearerAuth:[]}]}}}if(p("findMany")){r[`/api/${a}/{id}/${n}`]||(r[`/api/${a}/{id}/${n}`]={});const s=await l("findMany");r[`/api/${a}/{id}/${n}`].get={tags:[t],summary:`Get ${t} for ${e}`,description:`Retrieves all ${t} associated with the specified ${e}`,operationId:`get${pluralize_1.default.plural(o)}For${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"filter",in:"query",description:"Additional filter criteria in JSON format",schema:{type:"string"}},{name:"sort",in:"query",description:"Sort field (prefix with '-' for descending order)",schema:{type:"string"}},{name:"page",in:"query",description:"Page number (starts from 1)",schema:{type:"integer",minimum:1}},{name:"limit",in:"query",description:"Number of items per page",schema:{type:"integer",minimum:1,maximum:100}},{name:"fields",in:"query",description:"Comma-separated list of fields to include in response",schema:{type:"string"}}],responses:{200:{description:`List of ${t} retrieved successfully`,content:{"application/json":{schema:{type:"object",properties:{total:{type:"integer",description:"Total number of records matching the criteria"},results:{type:"integer",description:"Number of records returned in current page"},data:{type:"array",items:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`FindMany${o}`,s)}}}}}}},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${e} not found`}},security:[{BearerAuth:[]}]}}if(p("createMany")){const s=await l("createMany");r[`/api/${a}/{id}/${n}/many`]={post:{tags:[t],summary:`Create multiple ${t} for ${e}`,description:`Creates multiple ${t} records associated with the specified ${e}`,operationId:`createMany${o}For${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}}],requestBody:{description:`Array of ${i} data to create`,required:!0,content:{"application/json":{schema:{type:"array",items:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`CreateMany${o}`,s)}}}}},responses:{201:{description:`${t} created successfully`,content:{"application/json":{schema:{type:"object",properties:{count:{type:"integer",description:"Number of records created"}}}}}},400:{description:"Invalid input data provided"},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${e} not found`}},security:[{BearerAuth:[]}]}}}if(p("updateMany")){r[`/api/${a}/{id}/${n}/many`]||(r[`/api/${a}/{id}/${n}/many`]={});const s=await l("updateMany");r[`/api/${a}/{id}/${n}/many`].patch={tags:[t],summary:`Update multiple ${t} for ${e}`,description:`Updates multiple ${t} records associated with the specified ${e}`,operationId:`updateMany${o}For${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"filter",in:"query",description:"Additional filter criteria in JSON format",schema:{type:"string"}}],requestBody:{description:`Partial ${i} data to update`,required:!0,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`UpdateMany${o}`,s)}}}},responses:{200:{description:`${t} updated successfully`,content:{"application/json":{schema:{type:"object",properties:{count:{type:"integer",description:"Number of records updated"}}}}}},400:{description:"Invalid input data provided"},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${e} not found`}},security:[{BearerAuth:[]}]}}if(p("deleteMany")&&(r[`/api/${a}/{id}/${n}/many`]||(r[`/api/${a}/{id}/${n}/many`]={}),r[`/api/${a}/{id}/${n}/many`].delete={tags:[t],summary:`Delete multiple ${t} for ${e}`,description:`Deletes multiple ${t} records associated with the specified ${e}`,operationId:`deleteMany${o}For${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"filter",in:"query",description:"Additional filter criteria in JSON format",schema:{type:"string"}}],responses:{200:{description:`${t} deleted successfully`,content:{"application/json":{schema:{type:"object",properties:{count:{type:"integer",description:"Number of records deleted"}}}}}},400:{description:"Missing filter criteria"},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${e} not found`}},security:[{BearerAuth:[]}]}),p("findOne")){const s=await l("findOne");r[`/api/${a}/{id}/${n}/{childId}`]={get:{tags:[t],summary:`Get ${i} by ID for ${e}`,description:`Retrieves a single ${i} record by its unique identifier associated with the specified ${e}`,operationId:`get${o}ByIdFor${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"childId",in:"path",description:`Unique identifier of the ${i}`,required:!0,schema:{type:"string"}}],responses:{200:{description:`${i} retrieved successfully`,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`FindOne${o}`,s)}}}},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${i} or ${e} not found`}},security:[{BearerAuth:[]}]}}}if(p("updateOne")){r[`/api/${a}/{id}/${n}/{childId}`]||(r[`/api/${a}/{id}/${n}/{childId}`]={});const s=await l("update");r[`/api/${a}/{id}/${n}/{childId}`].patch={tags:[t],summary:`Update ${i} by ID for ${e}`,description:`Updates a single ${i} record by its unique identifier associated with the specified ${e}`,operationId:`update${o}ByIdFor${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"childId",in:"path",description:`Unique identifier of the ${i}`,required:!0,schema:{type:"string"}}],requestBody:{description:`Partial ${i} data to update`,required:!0,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`Update${o}`,s)}}}},responses:{200:{description:`${i} updated successfully`,content:{"application/json":{schema:{$ref:(0,swagger_router_helpers_1.getSchemaRef)(`${o}`,s)}}}},400:{description:"Invalid input data provided"},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${i} or ${e} not found`}},security:[{BearerAuth:[]}]}}p("deleteOne")&&(r[`/api/${a}/{id}/${n}/{childId}`]||(r[`/api/${a}/{id}/${n}/{childId}`]={}),r[`/api/${a}/{id}/${n}/{childId}`].delete={tags:[t],summary:`Delete ${i} by ID for ${e}`,description:`Permanently deletes a single ${i} record by its unique identifier associated with the specified ${e}`,operationId:`delete${o}ByIdFor${(0,utils_1.pascalCase)(d)}`,parameters:[{name:"id",in:"path",description:`Unique identifier of the ${e}`,required:!0,schema:{type:"string"}},{name:"childId",in:"path",description:`Unique identifier of the ${i}`,required:!0,schema:{type:"string"}}],responses:{204:{description:`${i} deleted successfully`},401:{description:"Authentication required"},403:{description:"Insufficient permissions"},404:{description:`${i} or ${e} not found`}},security:[{BearerAuth:[]}]})}
|