@koalarx/nest 3.0.3 → 3.0.4
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/core/backgroud-services/cron-service/cron-job.handler.base.d.ts +16 -0
- package/core/backgroud-services/cron-service/cron-job.handler.base.js +49 -0
- package/core/backgroud-services/event-service/event-class.d.ts +5 -0
- package/core/backgroud-services/event-service/event-class.js +11 -0
- package/core/backgroud-services/event-service/event-handler.base.d.ts +8 -0
- package/core/backgroud-services/event-service/event-handler.base.js +14 -0
- package/core/backgroud-services/event-service/event-is-trigger.d.ts +3 -0
- package/core/backgroud-services/event-service/event-is-trigger.js +7 -0
- package/core/backgroud-services/event-service/event-job.d.ts +13 -0
- package/core/backgroud-services/event-service/event-job.js +21 -0
- package/core/backgroud-services/event-service/event-queue.d.ts +17 -0
- package/core/backgroud-services/event-service/event-queue.js +62 -0
- package/core/constants/query-params.d.ts +6 -0
- package/core/constants/query-params.js +8 -0
- package/core/controllers/base.controller.d.ts +4 -0
- package/core/controllers/base.controller.js +6 -0
- package/core/controllers/controller.decorator.d.ts +2 -0
- package/core/controllers/controller.decorator.js +11 -0
- package/core/controllers/created-registre-response.base.d.ts +10 -0
- package/core/controllers/created-registre-response.base.js +35 -0
- package/core/controllers/list-response.base.d.ts +4 -0
- package/core/controllers/list-response.base.js +21 -0
- package/core/controllers/pagination.request.d.ts +10 -0
- package/core/controllers/pagination.request.js +56 -0
- package/core/controllers/router-config.base.d.ts +7 -0
- package/core/controllers/router-config.base.js +18 -0
- package/core/controllers/schemas/boolean.schema.d.ts +2 -0
- package/core/controllers/schemas/boolean.schema.js +12 -0
- package/core/controllers/schemas/document-number.schema.d.ts +1 -0
- package/core/controllers/schemas/document-number.schema.js +26 -0
- package/core/controllers/schemas/email.schema.d.ts +1 -0
- package/core/controllers/schemas/email.schema.js +13 -0
- package/core/controllers/schemas/list-query.schema.d.ts +17 -0
- package/core/controllers/schemas/list-query.schema.js +19 -0
- package/core/controllers/schemas/native-enum.schema.d.ts +7 -0
- package/core/controllers/schemas/native-enum.schema.js +28 -0
- package/core/controllers/schemas/set-mask-document-number.schema.d.ts +1 -0
- package/core/controllers/schemas/set-mask-document-number.schema.js +13 -0
- package/core/database/entity.base.d.ts +20 -0
- package/core/database/entity.base.js +71 -0
- package/core/database/entity.decorator.d.ts +13 -0
- package/core/database/entity.decorator.js +23 -0
- package/core/database/prisma-client-with-custom-transaction.interface.d.ts +8 -0
- package/core/database/prisma-client-with-custom-transaction.interface.js +2 -0
- package/core/database/prisma-resolver.d.ts +2 -0
- package/core/database/prisma-resolver.js +74 -0
- package/core/database/prisma-transactional-client.d.ts +11 -0
- package/core/database/prisma-transactional-client.js +25 -0
- package/core/database/prisma.service.d.ts +24 -0
- package/core/database/prisma.service.js +104 -0
- package/core/database/repository.base.d.ts +44 -0
- package/core/database/repository.base.js +360 -0
- package/core/dtos/pagination.dto.d.ts +9 -0
- package/core/dtos/pagination.dto.js +49 -0
- package/core/errors/bad-request.error.d.ts +5 -0
- package/core/errors/bad-request.error.js +10 -0
- package/core/errors/conflict.error.d.ts +4 -0
- package/core/errors/conflict.error.js +10 -0
- package/core/errors/error.base.d.ts +4 -0
- package/core/errors/error.base.js +11 -0
- package/core/errors/no-content.error.d.ts +5 -0
- package/core/errors/no-content.error.js +10 -0
- package/core/errors/not-allowed.error.d.ts +5 -0
- package/core/errors/not-allowed.error.js +10 -0
- package/core/errors/resource-not-found.error.d.ts +5 -0
- package/core/errors/resource-not-found.error.js +10 -0
- package/{src/core/errors/use-case-error.ts → core/errors/use-case-error.d.ts} +1 -1
- package/core/errors/use-case-error.js +2 -0
- package/core/errors/user-already-exist.error.d.ts +4 -0
- package/core/errors/user-already-exist.error.js +10 -0
- package/core/errors/wrong-credentials.error.d.ts +4 -0
- package/core/errors/wrong-credentials.error.js +10 -0
- package/core/health-check/health-check.controller.d.ts +5 -0
- package/core/health-check/health-check.controller.js +32 -0
- package/core/health-check/health-check.module.d.ts +2 -0
- package/core/health-check/health-check.module.js +19 -0
- package/core/index.d.ts +18 -0
- package/core/index.js +7 -0
- package/core/koala-app.d.ts +64 -0
- package/core/koala-app.js +252 -0
- package/core/koala-global-vars.d.ts +7 -0
- package/core/koala-global-vars.js +9 -0
- package/core/koala-nest-database.module.d.ts +16 -0
- package/core/koala-nest-database.module.js +52 -0
- package/core/koala-nest-http.module.d.ts +13 -0
- package/core/koala-nest-http.module.js +37 -0
- package/core/koala-nest.module.d.ts +17 -0
- package/core/koala-nest.module.js +66 -0
- package/core/mapping/auto-mapping-class-context.d.ts +16 -0
- package/core/mapping/auto-mapping-class-context.js +18 -0
- package/core/mapping/auto-mapping-context.d.ts +11 -0
- package/core/mapping/auto-mapping-context.js +24 -0
- package/core/mapping/auto-mapping-list.d.ts +27 -0
- package/core/mapping/auto-mapping-list.js +94 -0
- package/core/mapping/auto-mapping-profile.d.ts +3 -0
- package/core/mapping/auto-mapping-profile.js +6 -0
- package/core/mapping/auto-mapping.decorator.d.ts +9 -0
- package/core/mapping/auto-mapping.decorator.js +27 -0
- package/core/mapping/auto-mapping.module.d.ts +5 -0
- package/core/mapping/auto-mapping.module.js +29 -0
- package/core/mapping/auto-mapping.service.d.ts +14 -0
- package/core/mapping/auto-mapping.service.js +140 -0
- package/core/mapping/create-map.d.ts +3 -0
- package/core/mapping/create-map.js +7 -0
- package/core/mapping/for-member.d.ts +5 -0
- package/core/mapping/for-member.js +8 -0
- package/core/request-overflow/request-handler.base.d.ts +4 -0
- package/core/request-overflow/request-handler.base.js +6 -0
- package/core/request-overflow/request-result.d.ts +15 -0
- package/core/request-overflow/request-result.js +37 -0
- package/core/request-overflow/request-validator.base.d.ts +7 -0
- package/core/request-overflow/request-validator.base.js +26 -0
- package/core/security/strategies/api-key.strategy.d.ts +16 -0
- package/core/security/strategies/api-key.strategy.js +31 -0
- package/core/utils/assing-object.d.ts +5 -0
- package/core/utils/assing-object.js +6 -0
- package/core/utils/env.config.d.ts +6 -0
- package/core/utils/env.config.js +18 -0
- package/core/utils/filter-request-params.d.ts +13 -0
- package/core/utils/filter-request-params.js +22 -0
- package/core/utils/find-on-list.d.ts +2 -0
- package/core/utils/find-on-list.js +13 -0
- package/core/utils/get-type-by-prop.d.ts +2 -0
- package/core/utils/get-type-by-prop.js +11 -0
- package/core/utils/instanciate-class-with-dependencies-injection.d.ts +2 -0
- package/core/utils/instanciate-class-with-dependencies-injection.js +10 -0
- package/core/utils/interfaces/icomparable.d.ts +5 -0
- package/core/utils/interfaces/icomparable.js +6 -0
- package/core/utils/list.d.ts +39 -0
- package/core/utils/list.js +168 -0
- package/core/utils/promise-all.d.ts +7 -0
- package/core/utils/promise-all.js +19 -0
- package/core/utils/set-mask-document-number.d.ts +1 -0
- package/core/utils/set-mask-document-number.js +13 -0
- package/core/validators/file-validator.d.ts +27 -0
- package/core/validators/file-validator.js +94 -0
- package/decorators/api-exclude-endpoint-diff-develop.decorator.d.ts +1 -0
- package/decorators/api-exclude-endpoint-diff-develop.decorator.js +9 -0
- package/decorators/api-property-enum.decorator.d.ts +8 -0
- package/decorators/api-property-enum.decorator.js +21 -0
- package/decorators/api-property-only-develop.decorator.d.ts +2 -0
- package/decorators/api-property-only-develop.decorator.js +9 -0
- package/decorators/cookies.decorator.d.ts +1 -0
- package/decorators/cookies.decorator.js +8 -0
- package/decorators/is-public.decorator.d.ts +2 -0
- package/decorators/is-public.decorator.js +7 -0
- package/decorators/upload.decorator.d.ts +1 -0
- package/decorators/upload.decorator.js +18 -0
- package/env/env.d.ts +25 -0
- package/env/env.js +14 -0
- package/env/env.module.d.ts +2 -0
- package/env/env.module.js +20 -0
- package/env/env.service.d.ts +7 -0
- package/env/env.service.js +28 -0
- package/filters/domain-errors.filter.d.ts +18 -0
- package/filters/domain-errors.filter.js +92 -0
- package/filters/global-exception.filter.d.ts +8 -0
- package/filters/global-exception.filter.js +68 -0
- package/filters/prisma-validation-exception.filter.d.ts +10 -0
- package/filters/prisma-validation-exception.filter.js +82 -0
- package/filters/zod-errors.filter.d.ts +9 -0
- package/filters/zod-errors.filter.js +60 -0
- package/package.json +4 -1
- package/services/logging/ilogging.service.d.ts +16 -0
- package/services/logging/ilogging.service.js +6 -0
- package/services/logging/logging.service.d.ts +4 -0
- package/services/logging/logging.service.js +20 -0
- package/services/redis/iredis.service.d.ts +6 -0
- package/services/redis/iredis.service.js +6 -0
- package/services/redis/redis.service.d.ts +14 -0
- package/services/redis/redis.service.js +65 -0
- package/services/redlock/ired-lock.service.d.ts +4 -0
- package/services/redlock/ired-lock.service.js +6 -0
- package/services/redlock/red-lock.service.d.ts +9 -0
- package/services/redlock/red-lock.service.js +46 -0
- package/test/koala-app-test-dependencies.d.ts +10 -0
- package/test/koala-app-test-dependencies.js +13 -0
- package/test/koala-app-test.d.ts +22 -0
- package/test/koala-app-test.js +77 -0
- package/test/repositories/in-memory-base.repository.d.ts +17 -0
- package/test/repositories/in-memory-base.repository.js +65 -0
- package/test/services/fake-logging.service.d.ts +4 -0
- package/test/services/fake-logging.service.js +9 -0
- package/test/services/fake-red-lock.service.d.ts +5 -0
- package/test/services/fake-red-lock.service.js +11 -0
- package/test/utils/create-e2e-database.d.ts +2 -0
- package/test/utils/create-e2e-database.js +47 -0
- package/test/utils/drop-e2e-database.d.ts +2 -0
- package/test/utils/drop-e2e-database.js +33 -0
- package/test/utils/wait-for.d.ts +1 -0
- package/test/utils/wait-for.js +21 -0
- package/tsconfig.lib.tsbuildinfo +1 -0
- package/CHANGELOG.md +0 -27
- package/src/core/backgroud-services/cron-service/cron-job.handler.base.ts +0 -66
- package/src/core/backgroud-services/cron-service/cron-job.handler.spec.ts +0 -38
- package/src/core/backgroud-services/event-service/event-class.ts +0 -5
- package/src/core/backgroud-services/event-service/event-handler.base.ts +0 -17
- package/src/core/backgroud-services/event-service/event-is-trigger.ts +0 -3
- package/src/core/backgroud-services/event-service/event-job.ts +0 -28
- package/src/core/backgroud-services/event-service/event-queue.spec.ts +0 -47
- package/src/core/backgroud-services/event-service/event-queue.ts +0 -107
- package/src/core/constants/query-params.ts +0 -7
- package/src/core/controllers/base.controller.ts +0 -9
- package/src/core/controllers/controller.decorator.ts +0 -10
- package/src/core/controllers/created-registre-response.base.ts +0 -17
- package/src/core/controllers/list-response.base.ts +0 -8
- package/src/core/controllers/pagination.request.ts +0 -41
- package/src/core/controllers/router-config.base.ts +0 -14
- package/src/core/controllers/schemas/boolean.schema.ts +0 -10
- package/src/core/controllers/schemas/document-number.schema.ts +0 -23
- package/src/core/controllers/schemas/email.schema.ts +0 -13
- package/src/core/controllers/schemas/list-query.schema.ts +0 -17
- package/src/core/controllers/schemas/native-enum.schema.ts +0 -34
- package/src/core/controllers/schemas/set-mask-document-number.schema.ts +0 -13
- package/src/core/database/entity.base.ts +0 -95
- package/src/core/database/entity.decorator.spec.ts +0 -71
- package/src/core/database/entity.decorator.ts +0 -39
- package/src/core/database/prisma-client-with-custom-transaction.interface.ts +0 -13
- package/src/core/database/prisma-resolver.ts +0 -99
- package/src/core/database/prisma-transactional-client.ts +0 -43
- package/src/core/database/prisma.service.ts +0 -136
- package/src/core/database/repository.base.ts +0 -548
- package/src/core/dtos/pagination.dto.ts +0 -35
- package/src/core/errors/bad-request.error.ts +0 -8
- package/src/core/errors/conflict.error.ts +0 -7
- package/src/core/errors/error.base.ts +0 -5
- package/src/core/errors/no-content.error.ts +0 -8
- package/src/core/errors/not-allowed.error.ts +0 -8
- package/src/core/errors/resource-not-found.error.ts +0 -8
- package/src/core/errors/user-already-exist.error.ts +0 -7
- package/src/core/errors/wrong-credentials.error.ts +0 -7
- package/src/core/health-check/health-check.controller.ts +0 -13
- package/src/core/health-check/health-check.module.ts +0 -7
- package/src/core/index.ts +0 -56
- package/src/core/koala-app.ts +0 -379
- package/src/core/koala-global-vars.ts +0 -8
- package/src/core/koala-nest-database.module.ts +0 -65
- package/src/core/koala-nest-http.module.ts +0 -44
- package/src/core/koala-nest.module.ts +0 -67
- package/src/core/mapping/auto-mapping-class-context.ts +0 -28
- package/src/core/mapping/auto-mapping-context.ts +0 -26
- package/src/core/mapping/auto-mapping-list.ts +0 -154
- package/src/core/mapping/auto-mapping-profile.ts +0 -3
- package/src/core/mapping/auto-mapping.decorator.ts +0 -54
- package/src/core/mapping/auto-mapping.module.ts +0 -17
- package/src/core/mapping/auto-mapping.service.ts +0 -187
- package/src/core/mapping/create-map.ts +0 -11
- package/src/core/mapping/for-member.ts +0 -16
- package/src/core/request-overflow/request-handler.base.ts +0 -8
- package/src/core/request-overflow/request-result.spec.ts +0 -23
- package/src/core/request-overflow/request-result.ts +0 -41
- package/src/core/request-overflow/request-validator.base.ts +0 -33
- package/src/core/security/strategies/api-key.strategy.ts +0 -45
- package/src/core/utils/assing-object.ts +0 -9
- package/src/core/utils/env.config.ts +0 -17
- package/src/core/utils/filter-request-params.ts +0 -23
- package/src/core/utils/find-on-list.ts +0 -18
- package/src/core/utils/get-type-by-prop.ts +0 -9
- package/src/core/utils/instanciate-class-with-dependencies-injection.ts +0 -12
- package/src/core/utils/interfaces/icomparable.ts +0 -6
- package/src/core/utils/list.spec.ts +0 -81
- package/src/core/utils/list.ts +0 -223
- package/src/core/utils/promise-all.ts +0 -24
- package/src/core/utils/set-mask-document-number.ts +0 -13
- package/src/core/validators/file-validator.ts +0 -113
- package/src/decorators/api-exclude-endpoint-diff-develop.decorator.ts +0 -15
- package/src/decorators/api-property-enum.decorator.ts +0 -58
- package/src/decorators/api-property-only-develop.decorator.ts +0 -6
- package/src/decorators/cookies.decorator.ts +0 -8
- package/src/decorators/is-public.decorator.ts +0 -5
- package/src/decorators/upload.decorator.ts +0 -31
- package/src/env/env.module.ts +0 -8
- package/src/env/env.service.ts +0 -12
- package/src/env/env.ts +0 -14
- package/src/filters/domain-errors.filter.ts +0 -97
- package/src/filters/global-exception.filter.ts +0 -60
- package/src/filters/prisma-validation-exception.filter.ts +0 -73
- package/src/filters/zod-errors.filter.ts +0 -48
- package/src/services/logging/ilogging.service.ts +0 -17
- package/src/services/logging/logging.service.ts +0 -10
- package/src/services/redis/iredis.service.ts +0 -11
- package/src/services/redis/redis.service.ts +0 -70
- package/src/services/redlock/ired-lock.service.ts +0 -4
- package/src/services/redlock/red-lock.service.ts +0 -36
- package/src/test/koala-app-test-dependencies.ts +0 -15
- package/src/test/koala-app-test.ts +0 -103
- package/src/test/repositories/in-memory-base.repository.ts +0 -90
- package/src/test/services/fake-logging.service.ts +0 -7
- package/src/test/services/fake-red-lock.service.ts +0 -11
- package/src/test/utils/create-e2e-database.ts +0 -55
- package/src/test/utils/drop-e2e-database.ts +0 -36
- package/src/test/utils/wait-for.ts +0 -31
- package/tsconfig.lib.json +0 -11
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RepositoryBase = void 0;
|
|
4
|
+
const KlString_1 = require("@koalarx/utils/KlString");
|
|
5
|
+
const pagination_dto_1 = require("../dtos/pagination.dto");
|
|
6
|
+
const koala_global_vars_1 = require("../koala-global-vars");
|
|
7
|
+
const list_1 = require("../utils/list");
|
|
8
|
+
const entity_base_1 = require("./entity.base");
|
|
9
|
+
const auto_mapping_list_1 = require("../mapping/auto-mapping-list");
|
|
10
|
+
class RepositoryBase {
|
|
11
|
+
_context;
|
|
12
|
+
_modelName;
|
|
13
|
+
_include;
|
|
14
|
+
constructor({ context, modelName, include, }) {
|
|
15
|
+
this._context = context;
|
|
16
|
+
this._modelName = modelName;
|
|
17
|
+
this._include = include;
|
|
18
|
+
}
|
|
19
|
+
listRelationEntities(entity) {
|
|
20
|
+
const relationEntities = [];
|
|
21
|
+
Object.keys(entity).forEach((key) => {
|
|
22
|
+
if (entity[key] instanceof list_1.List) {
|
|
23
|
+
const list = entity[key];
|
|
24
|
+
list.toArray('added').forEach((item) => {
|
|
25
|
+
relationEntities.push(item);
|
|
26
|
+
relationEntities.push(...this.listRelationEntities(item));
|
|
27
|
+
});
|
|
28
|
+
list.toArray('updated').forEach((item) => {
|
|
29
|
+
relationEntities.push(item);
|
|
30
|
+
relationEntities.push(...this.listRelationEntities(item));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else if (entity[key] instanceof entity_base_1.EntityBase) {
|
|
34
|
+
relationEntities.push(entity[key]);
|
|
35
|
+
relationEntities.push(...this.listRelationEntities(entity[key]));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return relationEntities;
|
|
39
|
+
}
|
|
40
|
+
listToRelationActionList(entity) {
|
|
41
|
+
const relationCreates = [];
|
|
42
|
+
const relationUpdates = [];
|
|
43
|
+
const relationDeletes = [];
|
|
44
|
+
Object.keys(entity).forEach((key) => {
|
|
45
|
+
if (entity[key] instanceof list_1.List) {
|
|
46
|
+
const list = entity[key];
|
|
47
|
+
const entityInstance = list.entityType;
|
|
48
|
+
const modelName = entityInstance.name;
|
|
49
|
+
const parentModelName = entity.constructor.name;
|
|
50
|
+
if (modelName) {
|
|
51
|
+
list.toArray('removed').forEach((item) => {
|
|
52
|
+
relationDeletes.push({
|
|
53
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
54
|
+
entityInstance,
|
|
55
|
+
schema: { where: { id: item._id } },
|
|
56
|
+
relations: [],
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
list.toArray('added').forEach((item) => {
|
|
60
|
+
relationCreates.push({
|
|
61
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
62
|
+
entityInstance,
|
|
63
|
+
schema: {
|
|
64
|
+
data: {
|
|
65
|
+
...this.entityToPrisma(item),
|
|
66
|
+
[(0, KlString_1.toCamelCase)(parentModelName)]: {
|
|
67
|
+
connect: {
|
|
68
|
+
[this.getIdPropName(entity)]: entity[this.getIdPropName(entity)],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
relations: this.listRelationEntities(item),
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
list.toArray('updated').forEach((item) => {
|
|
77
|
+
relationUpdates.push({
|
|
78
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
79
|
+
entityInstance,
|
|
80
|
+
schema: {
|
|
81
|
+
where: { id: item._id },
|
|
82
|
+
data: this.entityToPrisma(item),
|
|
83
|
+
},
|
|
84
|
+
relations: this.listRelationEntities(item),
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return { relationCreates, relationUpdates, relationDeletes };
|
|
91
|
+
}
|
|
92
|
+
entityToPrisma(entity) {
|
|
93
|
+
const prismaSchema = {};
|
|
94
|
+
Object.keys(entity)
|
|
95
|
+
.filter((key) => !['id', '_id', '_action'].includes(key))
|
|
96
|
+
.filter((key) => !(entity[key] instanceof Function || entity[key] instanceof list_1.List))
|
|
97
|
+
.forEach((key) => {
|
|
98
|
+
if (entity[key] instanceof entity_base_1.EntityBase) {
|
|
99
|
+
if (entity[key]._action === entity_base_1.EntityActionType.create) {
|
|
100
|
+
if (entity[key][this.getIdPropName(entity)]) {
|
|
101
|
+
prismaSchema[key] = {
|
|
102
|
+
connectOrCreate: {
|
|
103
|
+
where: {
|
|
104
|
+
[this.getIdPropName(entity)]: entity[key][this.getIdPropName(entity)],
|
|
105
|
+
},
|
|
106
|
+
create: this.entityToPrisma(entity[key]),
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
prismaSchema[key] = {
|
|
112
|
+
create: this.entityToPrisma(entity[key]),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
prismaSchema[key] = {
|
|
118
|
+
update: this.entityToPrisma(entity[key]),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
prismaSchema[key] = entity[key];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return prismaSchema;
|
|
127
|
+
}
|
|
128
|
+
findManySchema(where, pagination) {
|
|
129
|
+
return {
|
|
130
|
+
include: this.getInclude(),
|
|
131
|
+
where,
|
|
132
|
+
orderBy: pagination?.generateOrderBy(),
|
|
133
|
+
skip: pagination?.skip(),
|
|
134
|
+
take: (pagination?.limit ?? 0) > 0 ? pagination?.limit : undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
createEntity(data, entityClass) {
|
|
138
|
+
const entity = new (entityClass || this._modelName)();
|
|
139
|
+
entity._action = entity_base_1.EntityActionType.update;
|
|
140
|
+
entity.automap(data);
|
|
141
|
+
return entity;
|
|
142
|
+
}
|
|
143
|
+
orphanRemoval(client, entity) {
|
|
144
|
+
const where = {};
|
|
145
|
+
Object.keys(entity)
|
|
146
|
+
.filter((key) => key === 'id' || key.includes('Id'))
|
|
147
|
+
.forEach((key) => (where[key] = entity[key]));
|
|
148
|
+
return client[(0, KlString_1.toCamelCase)(entity.constructor.name)].delete({ where });
|
|
149
|
+
}
|
|
150
|
+
getIdPropName(entity) {
|
|
151
|
+
return (Reflect.getMetadata('entity:id', entity ? entity.constructor.prototype : this._modelName.prototype) ?? 'id');
|
|
152
|
+
}
|
|
153
|
+
getInclude(include) {
|
|
154
|
+
include = include ?? this._include ?? {};
|
|
155
|
+
const result = {};
|
|
156
|
+
Object.keys(include).forEach((key) => {
|
|
157
|
+
if (typeof include[key] === 'boolean') {
|
|
158
|
+
result[key] = include[key];
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
result[key] = {
|
|
162
|
+
include: this.getInclude(include[key]),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
getPropNameFromEntitySource(source, entity) {
|
|
169
|
+
return Object.keys(source).find((key) => {
|
|
170
|
+
const propDefinitions = auto_mapping_list_1.AutoMappingList.getPropDefinitions(source.constructor, key);
|
|
171
|
+
if (propDefinitions) {
|
|
172
|
+
if (propDefinitions.type === entity.name) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
else if (source[key] instanceof list_1.List) {
|
|
176
|
+
const list = source[key];
|
|
177
|
+
return list.entityType?.name === entity.name;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
persistRelations(transaction, entity) {
|
|
184
|
+
const { relationCreates, relationUpdates, relationDeletes } = this.listToRelationActionList(entity);
|
|
185
|
+
return Promise.all([
|
|
186
|
+
...relationCreates.map((relationCreate) => transaction[relationCreate.modelName]
|
|
187
|
+
.create(relationCreate.schema)
|
|
188
|
+
.then((response) => {
|
|
189
|
+
return Promise.all(relationCreate.relations.map((relation) => {
|
|
190
|
+
const relationPropName = this.getPropNameFromEntitySource(relation, relationCreate.entityInstance);
|
|
191
|
+
if (!relationPropName) {
|
|
192
|
+
throw new Error(`Propname not found for relation entity ${relation.constructor.name} on entity ${relationCreate.entityInstance.constructor.name}`);
|
|
193
|
+
}
|
|
194
|
+
const relationEntity = this.createEntity(response, relationCreate.entityInstance);
|
|
195
|
+
relationEntity._action = entity_base_1.EntityActionType.create;
|
|
196
|
+
relation[relationPropName] = relationEntity;
|
|
197
|
+
return transaction[(0, KlString_1.toCamelCase)(relation.constructor.name)]
|
|
198
|
+
.create({
|
|
199
|
+
data: this.entityToPrisma(relation),
|
|
200
|
+
})
|
|
201
|
+
.then((response) => {
|
|
202
|
+
entity[this.getIdPropName(relation)] =
|
|
203
|
+
response[this.getIdPropName(relation)];
|
|
204
|
+
return this.persistRelations(transaction, relation);
|
|
205
|
+
});
|
|
206
|
+
}));
|
|
207
|
+
})),
|
|
208
|
+
...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema)),
|
|
209
|
+
...relationDeletes.map((relation) => this.removeMany(relation.schema)),
|
|
210
|
+
]);
|
|
211
|
+
}
|
|
212
|
+
context(transactionalClient) {
|
|
213
|
+
const modelName = this._modelName.name;
|
|
214
|
+
if (!modelName)
|
|
215
|
+
throw new Error('modelName não informado no contrutor do repositorio');
|
|
216
|
+
const contextKey = (0, KlString_1.toCamelCase)(modelName);
|
|
217
|
+
if (transactionalClient) {
|
|
218
|
+
return transactionalClient[contextKey];
|
|
219
|
+
}
|
|
220
|
+
return this._context[contextKey];
|
|
221
|
+
}
|
|
222
|
+
async findById(id) {
|
|
223
|
+
return this.context()
|
|
224
|
+
.findFirst({
|
|
225
|
+
include: this.getInclude(),
|
|
226
|
+
where: { [this.getIdPropName()]: id },
|
|
227
|
+
})
|
|
228
|
+
.then((response) => {
|
|
229
|
+
if (response) {
|
|
230
|
+
return this.createEntity(response);
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
async findFirst(where) {
|
|
236
|
+
return this.context()
|
|
237
|
+
.findFirst({
|
|
238
|
+
include: this.getInclude(),
|
|
239
|
+
where,
|
|
240
|
+
})
|
|
241
|
+
.then((response) => {
|
|
242
|
+
if (response) {
|
|
243
|
+
return this.createEntity(response);
|
|
244
|
+
}
|
|
245
|
+
return null;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async findUnique(where) {
|
|
249
|
+
return this.context()
|
|
250
|
+
.findUnique({
|
|
251
|
+
include: this.getInclude(),
|
|
252
|
+
where,
|
|
253
|
+
})
|
|
254
|
+
.then((response) => {
|
|
255
|
+
if (response) {
|
|
256
|
+
return this.createEntity(response);
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
async findMany(where, pagination) {
|
|
262
|
+
return this.context()
|
|
263
|
+
.findMany(this.findManySchema(where, pagination))
|
|
264
|
+
.then((result) => result.map((response) => this.createEntity(response)));
|
|
265
|
+
}
|
|
266
|
+
async findManyAndCount(where, pagination) {
|
|
267
|
+
const count = await this.context().count({ where });
|
|
268
|
+
if (count > 0) {
|
|
269
|
+
const items = await this.findMany(where, Object.assign(new pagination_dto_1.PaginationDto(), pagination));
|
|
270
|
+
return { items, count };
|
|
271
|
+
}
|
|
272
|
+
return { items: [], count };
|
|
273
|
+
}
|
|
274
|
+
async saveChanges(entity, updateWhere) {
|
|
275
|
+
const prismaEntity = this.entityToPrisma(entity);
|
|
276
|
+
if (entity._action === entity_base_1.EntityActionType.create) {
|
|
277
|
+
return this.withTransaction((client) => this.context(client)
|
|
278
|
+
.create({
|
|
279
|
+
data: prismaEntity,
|
|
280
|
+
include: this.getInclude(),
|
|
281
|
+
})
|
|
282
|
+
.then((response) => {
|
|
283
|
+
entity[this.getIdPropName()] = response[this.getIdPropName()];
|
|
284
|
+
return this.persistRelations(client, entity).then(() => entity);
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
const where = updateWhere ?? { id: entity._id };
|
|
289
|
+
return this.withTransaction((client) => this.context(client)
|
|
290
|
+
.update({
|
|
291
|
+
where,
|
|
292
|
+
data: prismaEntity,
|
|
293
|
+
})
|
|
294
|
+
.then(() => this.persistRelations(client, entity))).then(() => this.findUnique(where));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
async saveMany(entities, updateWhere) {
|
|
298
|
+
await this.withTransaction(async (client) => {
|
|
299
|
+
const prismaEntities = entities.map((entity) => this.entityToPrisma(entity));
|
|
300
|
+
return Promise.all([
|
|
301
|
+
this.context(client).createMany({
|
|
302
|
+
data: prismaEntities,
|
|
303
|
+
skipDuplicates: true,
|
|
304
|
+
}),
|
|
305
|
+
...entities
|
|
306
|
+
.filter((entity) => !!entity._id)
|
|
307
|
+
.map((entity) => this.context(client).update({
|
|
308
|
+
data: entity,
|
|
309
|
+
where: updateWhere ?? { id: entity._id },
|
|
310
|
+
})),
|
|
311
|
+
]);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async remove(where, notCascadeEntityProps, externalServices) {
|
|
315
|
+
const entity = await this.findUnique(where);
|
|
316
|
+
if (!entity) {
|
|
317
|
+
throw new Error(`Entity not found for where: ${JSON.stringify(where)}`);
|
|
318
|
+
}
|
|
319
|
+
const relationEntity = [];
|
|
320
|
+
Object.keys(entity).forEach((key) => {
|
|
321
|
+
if (entity[key] instanceof entity_base_1.EntityBase &&
|
|
322
|
+
!notCascadeEntityProps?.includes(key)) {
|
|
323
|
+
relationEntity.push(entity[key]);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
return this.withTransaction((client) => (externalServices
|
|
327
|
+
? externalServices.then(() => client)
|
|
328
|
+
: Promise.resolve(client)).then((client) => this.context(client)
|
|
329
|
+
.delete({ where })
|
|
330
|
+
.then((response) => Promise.all(relationEntity.map((entity) => this.orphanRemoval(client, entity))).then(() => response))));
|
|
331
|
+
}
|
|
332
|
+
async removeMany(where, notCascadeEntityProps, externalServices) {
|
|
333
|
+
const entities = await this.findMany(where);
|
|
334
|
+
if (entities.length === 0) {
|
|
335
|
+
throw new Error(`Entities not found for where: ${JSON.stringify(where)}`);
|
|
336
|
+
}
|
|
337
|
+
return this.withTransaction((client) => (externalServices
|
|
338
|
+
? externalServices.then(() => client)
|
|
339
|
+
: Promise.resolve(client)).then(async (client) => {
|
|
340
|
+
const relationEntity = [];
|
|
341
|
+
for (const entity of entities) {
|
|
342
|
+
Object.keys(entity).forEach((key) => {
|
|
343
|
+
if (entity[key] instanceof entity_base_1.EntityBase &&
|
|
344
|
+
!notCascadeEntityProps?.includes(key)) {
|
|
345
|
+
relationEntity.push(entity[key]);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
return this.context(client)
|
|
350
|
+
.deleteMany({ where })
|
|
351
|
+
.then((response) => Promise.all(relationEntity.map((entity) => this.orphanRemoval(client, entity))).then(() => response));
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
withTransaction(fn) {
|
|
355
|
+
return this._context.withTransaction(async (client) => {
|
|
356
|
+
return fn(new koala_global_vars_1.KoalaGlobalVars.dbTransactionContext(client));
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
exports.RepositoryBase = RepositoryBase;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PaginationDto = void 0;
|
|
13
|
+
const query_params_1 = require("../constants/query-params");
|
|
14
|
+
const auto_mapping_decorator_1 = require("../mapping/auto-mapping.decorator");
|
|
15
|
+
class PaginationDto {
|
|
16
|
+
page = 0;
|
|
17
|
+
limit = query_params_1.QUERY_FILTER_PARAMS.limit;
|
|
18
|
+
orderBy = '';
|
|
19
|
+
direction = 'asc';
|
|
20
|
+
skip() {
|
|
21
|
+
return (this.limit ?? 0) * (this.page ?? query_params_1.QUERY_FILTER_PARAMS.page);
|
|
22
|
+
}
|
|
23
|
+
generateOrderBy() {
|
|
24
|
+
if (this.orderBy) {
|
|
25
|
+
const orderByField = this.orderBy.split('.');
|
|
26
|
+
return orderByField.reduceRight((acc, item, index) => ({
|
|
27
|
+
[item]: index === orderByField.length - 1 ? this.direction : acc,
|
|
28
|
+
}), {});
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.PaginationDto = PaginationDto;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, auto_mapping_decorator_1.AutoMap)(),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], PaginationDto.prototype, "page", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, auto_mapping_decorator_1.AutoMap)(),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], PaginationDto.prototype, "limit", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, auto_mapping_decorator_1.AutoMap)(),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], PaginationDto.prototype, "orderBy", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, auto_mapping_decorator_1.AutoMap)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], PaginationDto.prototype, "direction", void 0);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BadRequestError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class BadRequestError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(message, data) {
|
|
7
|
+
super(message ?? 'Bad Request', data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.BadRequestError = BadRequestError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConflictError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class ConflictError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(identifier, data) {
|
|
7
|
+
super(`O registro ${identifier} já existe.`, data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ConflictError = ConflictError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorBase = void 0;
|
|
4
|
+
class ErrorBase extends Error {
|
|
5
|
+
data;
|
|
6
|
+
constructor(message, data) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.data = data;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ErrorBase = ErrorBase;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoContentError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class NoContentError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(message, data) {
|
|
7
|
+
super(message ?? 'No Content', data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.NoContentError = NoContentError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotAllowedError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class NotAllowedError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(message, data) {
|
|
7
|
+
super(message ?? 'Você não tem permissão para utilizar esse recurso.', data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.NotAllowedError = NotAllowedError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceNotFoundError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class ResourceNotFoundError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(name = 'Recurso', data) {
|
|
7
|
+
super(`${name} não encontrado(a).`, data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ResourceNotFoundError = ResourceNotFoundError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAlreadyExist = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class UserAlreadyExist extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(identifier, data) {
|
|
7
|
+
super(`User ${identifier} already exists`, data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.UserAlreadyExist = UserAlreadyExist;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WrongCredentialsError = void 0;
|
|
4
|
+
const error_base_1 = require("./error.base");
|
|
5
|
+
class WrongCredentialsError extends error_base_1.ErrorBase {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super('Credentials are not valid', data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.WrongCredentialsError = WrongCredentialsError;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HealthCheckController = void 0;
|
|
13
|
+
const is_public_decorator_1 = require("../../decorators/is-public.decorator");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
+
let HealthCheckController = class HealthCheckController {
|
|
17
|
+
healthCheck() {
|
|
18
|
+
return { status: 'ok' };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.HealthCheckController = HealthCheckController;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, common_1.Get)(),
|
|
24
|
+
(0, is_public_decorator_1.IsPublic)(),
|
|
25
|
+
(0, swagger_1.ApiExcludeEndpoint)(),
|
|
26
|
+
__metadata("design:type", Function),
|
|
27
|
+
__metadata("design:paramtypes", []),
|
|
28
|
+
__metadata("design:returntype", void 0)
|
|
29
|
+
], HealthCheckController.prototype, "healthCheck", null);
|
|
30
|
+
exports.HealthCheckController = HealthCheckController = __decorate([
|
|
31
|
+
(0, common_1.Controller)('health')
|
|
32
|
+
], HealthCheckController);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.HealthCheckModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const health_check_controller_1 = require("./health-check.controller");
|
|
12
|
+
let HealthCheckModule = class HealthCheckModule {
|
|
13
|
+
};
|
|
14
|
+
exports.HealthCheckModule = HealthCheckModule;
|
|
15
|
+
exports.HealthCheckModule = HealthCheckModule = __decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
controllers: [health_check_controller_1.HealthCheckController],
|
|
18
|
+
})
|
|
19
|
+
], HealthCheckModule);
|
package/core/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type FileType = Express.Multer.File;
|
|
2
|
+
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
3
|
+
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
4
|
+
export type CreatedRegister<TypeId = string> = {
|
|
5
|
+
id: TypeId;
|
|
6
|
+
};
|
|
7
|
+
export type ListResponse<TItem = any> = {
|
|
8
|
+
items: Array<TItem>;
|
|
9
|
+
count: number;
|
|
10
|
+
};
|
|
11
|
+
export type FileResponse = {
|
|
12
|
+
filename: string;
|
|
13
|
+
type: string;
|
|
14
|
+
base64: string;
|
|
15
|
+
};
|
|
16
|
+
export type QueryDirectionType = 'asc' | 'desc';
|
|
17
|
+
export { setPrismaClient } from './database/prisma-resolver';
|
|
18
|
+
export { setPrismaClientOptions } from './database/prisma.service';
|