@elsikora/nestjs-crud-automator 1.5.5 → 1.6.1
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/class/utility/dto/property/factory/boolean.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/boolean.class.js +1 -1
- package/dist/class/utility/dto/property/factory/boolean.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/date.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/date.class.js +1 -1
- package/dist/class/utility/dto/property/factory/date.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/enum.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/enum.class.js +1 -1
- package/dist/class/utility/dto/property/factory/enum.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/number.class.d.ts +3 -1
- package/dist/class/utility/dto/property/factory/number.class.js +3 -1
- package/dist/class/utility/dto/property/factory/number.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/object.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/object.class.js +1 -1
- package/dist/class/utility/dto/property/factory/object.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/string.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/string.class.js +1 -1
- package/dist/class/utility/dto/property/factory/string.class.js.map +1 -1
- package/dist/class/utility/dto/property/factory/uuid.class.d.ts +2 -1
- package/dist/class/utility/dto/property/factory/uuid.class.js +1 -1
- package/dist/class/utility/dto/property/factory/uuid.class.js.map +1 -1
- package/dist/constant/decorator/api/controller.constant.js +1 -1
- package/dist/constant/decorator/api/controller.constant.js.map +1 -1
- package/dist/decorator/api/function/create.decorator.js +15 -15
- package/dist/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/decorator/api/function/delete.decorator.js +16 -17
- package/dist/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/decorator/api/function/get-list.decorator.js +13 -14
- package/dist/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/decorator/api/function/get-many.decorator.js +15 -15
- package/dist/decorator/api/function/get-many.decorator.js.map +1 -1
- package/dist/decorator/api/function/get.decorator.js +15 -18
- package/dist/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/decorator/api/function/update.decorator.js +27 -28
- package/dist/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/decorator/api/method.decorator.js +110 -48
- package/dist/decorator/api/method.decorator.js.map +1 -1
- package/dist/decorator/api/property/boolean.decorator.js +41 -43
- package/dist/decorator/api/property/boolean.decorator.js.map +1 -1
- package/dist/decorator/api/property/date.decorator.js +102 -104
- package/dist/decorator/api/property/date.decorator.js.map +1 -1
- package/dist/decorator/api/property/enum.decorator.js +41 -44
- package/dist/decorator/api/property/enum.decorator.js.map +1 -1
- package/dist/decorator/api/property/number.decorator.js +114 -112
- package/dist/decorator/api/property/number.decorator.js.map +1 -1
- package/dist/decorator/api/property/object.decorator.js +41 -43
- package/dist/decorator/api/property/object.decorator.js.map +1 -1
- package/dist/decorator/api/property/string.decorator.js +101 -103
- package/dist/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/decorator/api/property/uuid.decorator.js +37 -39
- package/dist/decorator/api/property/uuid.decorator.js.map +1 -1
- package/dist/decorator/api/service.decorator.d.ts +1 -1
- package/dist/decorator/api/service.decorator.js +6 -6
- package/dist/decorator/api/service.decorator.js.map +1 -1
- package/dist/enum/decorator/api/action.enum.d.ts +14 -14
- package/dist/enum/decorator/api/action.enum.js +14 -14
- package/dist/enum/decorator/api/action.enum.js.map +1 -1
- package/dist/enum/exception.enum.d.ts +18 -18
- package/dist/enum/exception.enum.js +17 -17
- package/dist/enum/exception.enum.js.map +1 -1
- package/dist/enum/filter-operation.enum.d.ts +34 -32
- package/dist/enum/filter-operation.enum.js +60 -58
- package/dist/enum/filter-operation.enum.js.map +1 -1
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -1
- package/dist/enum/index.js.map +1 -1
- package/dist/enum/utility/error-string-action.enum.d.ts +41 -41
- package/dist/enum/utility/error-string-action.enum.js +41 -41
- package/dist/enum/utility/error-string-action.enum.js.map +1 -1
- package/dist/factory/api/controller.factory.d.ts +3 -3
- package/dist/factory/api/controller.factory.js +21 -27
- package/dist/factory/api/controller.factory.js.map +1 -1
- package/dist/interface/api-base-entity.interface.d.ts +0 -1
- package/dist/package.json +26 -26
- package/dist/type/decorator/api/property/describe/dto/query/get-list-properties.type.d.ts +1 -1
- package/dist/type/decorator/api/property/number-properties.type.d.ts +1 -1
- package/dist/utility/api/controller/apply-decorators.utility.js +0 -2
- package/dist/utility/api/controller/apply-decorators.utility.js.map +1 -1
- package/dist/utility/api/controller/apply-metadata.utility.js +0 -1
- package/dist/utility/api/controller/apply-metadata.utility.js.map +1 -1
- package/dist/utility/api/controller/get-list/transform-filter.utility.d.ts +2 -1
- package/dist/utility/api/controller/get-list/transform-filter.utility.js +12 -4
- package/dist/utility/api/controller/get-list/transform-filter.utility.js.map +1 -1
- package/dist/utility/api/controller/get-method-name.utility.js +1 -2
- package/dist/utility/api/controller/get-method-name.utility.js.map +1 -1
- package/dist/utility/api/controller/transform-data.utility.js +45 -45
- package/dist/utility/api/controller/transform-data.utility.js.map +1 -1
- package/dist/utility/api/controller/write-dto-swagger.utility.js +2 -2
- package/dist/utility/api/controller/write-dto-swagger.utility.js.map +1 -1
- package/dist/utility/api/filter-order-by-from-entity.utility.js +1 -1
- package/dist/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
- package/dist/utility/camel-case-string.utility.js +14 -2
- package/dist/utility/camel-case-string.utility.js.map +1 -1
- package/dist/utility/dto/analize.utility.d.ts +2 -1
- package/dist/utility/dto/analize.utility.js +1 -1
- package/dist/utility/dto/analize.utility.js.map +1 -1
- package/dist/utility/dto/generate-decorator.utility.js +1 -2
- package/dist/utility/dto/generate-decorator.utility.js.map +1 -1
- package/dist/utility/dto/generate-relation-response.utility.js +2 -1
- package/dist/utility/dto/generate-relation-response.utility.js.map +1 -1
- package/dist/utility/dto/generate.utility.js.map +1 -1
- package/dist/utility/dto/get-get-list-query-base-class.utility.js +0 -2
- package/dist/utility/dto/get-get-list-query-base-class.utility.js.map +1 -1
- package/dist/utility/dto/is-property-exposed-for-guard.utility.js +0 -2
- package/dist/utility/dto/is-property-exposed-for-guard.utility.js.map +1 -1
- package/dist/utility/is-error-of-type.utility.js +19 -19
- package/dist/utility/is-error-of-type.utility.js.map +1 -1
- package/dist/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -1
- package/package.json +26 -26
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeBooleanProperties, TApiPropertyDescribeDtoProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryBoolean<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeBooleanProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeBooleanProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryBoolean = void 0;
|
|
4
4
|
const boolean_decorator_1 = require("../../../../../decorator/api/property/boolean.decorator");
|
|
5
5
|
class DtoPropertyFactoryBoolean {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { type, ...restProperties } = metadata;
|
|
8
8
|
return (0, boolean_decorator_1.ApiPropertyBoolean)({
|
|
9
9
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/boolean.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"boolean.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/boolean.class.ts"],"names":[],"mappings":";;;AAIA,+FAA6F;AAE7F,MAAa,yBAAyB;IACrC,MAAM,CAAC,QAA+C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC7L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAA0C,QAAQ,CAAC;QAEpF,OAAO,IAAA,sCAAkB,EAAC;YACzB,MAAM;YACN,GAAG,MAAM;YACT,GAAG,cAAc;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAVD,8DAUC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeDateProperties, TApiPropertyDescribeDtoProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryDate<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeDateProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeDateProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryDate = void 0;
|
|
4
4
|
const date_decorator_1 = require("../../../../../decorator/api/property/date.decorator");
|
|
5
5
|
class DtoPropertyFactoryDate {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { type, ...restProperties } = metadata;
|
|
8
8
|
return (0, date_decorator_1.ApiPropertyDate)({
|
|
9
9
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/date.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"date.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/date.class.ts"],"names":[],"mappings":";;;AAIA,yFAAuF;AAEvF,MAAa,sBAAsB;IAClC,MAAM,CAAC,QAA4C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC1L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAuC,QAAQ,CAAC;QAEjF,OAAO,IAAA,gCAAe,EAAC;YACtB,MAAM;YACN,GAAG,MAAM;YACT,GAAG,cAAc;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAVD,wDAUC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeDtoProperties, TApiPropertyDescribeEnumProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryEnum<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeEnumProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeEnumProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryEnum = void 0;
|
|
4
4
|
const enum_decorator_1 = require("../../../../../decorator/api/property/enum.decorator");
|
|
5
5
|
class DtoPropertyFactoryEnum {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { type, ...restProperties } = metadata;
|
|
8
8
|
return (0, enum_decorator_1.ApiPropertyEnum)({
|
|
9
9
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/enum.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"enum.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/enum.class.ts"],"names":[],"mappings":";;;AAIA,yFAAuF;AAEvF,MAAa,sBAAsB;IAClC,MAAM,CAAC,QAA4C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC1L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAuC,QAAQ,CAAC;QAEjF,OAAO,IAAA,gCAAe,EAAC;YACtB,MAAM;YACN,GAAG,MAAM;YACT,GAAG,cAAc;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAVD,wDAUC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { IApiEntity, IDtoGenerateFactory } from "src/interface";
|
|
2
2
|
import type { TApiPropertyDescribeDtoProperties, TApiPropertyDescribeNumberProperties } from "src/type";
|
|
3
|
+
import type { EApiRouteType } from "../../../../../enum";
|
|
4
|
+
import { EApiDtoType } from "../../../../../enum";
|
|
3
5
|
export declare class DtoPropertyFactoryNumber<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeNumberProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
6
|
+
create(metadata: TApiPropertyDescribeNumberProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
7
|
}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DtoPropertyFactoryNumber = void 0;
|
|
4
4
|
const number_decorator_1 = require("../../../../../decorator/api/property/number.decorator");
|
|
5
|
+
const enum_1 = require("../../../../../enum");
|
|
5
6
|
class DtoPropertyFactoryNumber {
|
|
6
|
-
create(metadata, entity, config) {
|
|
7
|
+
create(metadata, entity, config, _method, dtoType, _propertyName) {
|
|
7
8
|
const { type, ...restProperties } = metadata;
|
|
8
9
|
return (0, number_decorator_1.ApiPropertyNumber)({
|
|
9
10
|
entity,
|
|
10
11
|
...config,
|
|
11
12
|
...restProperties,
|
|
13
|
+
multipleOf: dtoType === enum_1.EApiDtoType.REQUEST ? undefined : metadata.multipleOf,
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/number.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"number.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/number.class.ts"],"names":[],"mappings":";;;AAKA,6FAA2F;AAC3F,8CAAkD;AAElD,MAAa,wBAAwB;IACpC,MAAM,CAAC,QAA8C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,OAAoB,EAAE,aAAqB;QAC3L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAyC,QAAQ,CAAC;QAEnF,OAAO,IAAA,oCAAiB,EAAC;YACxB,MAAM;YACN,GAAG,MAAM;YACT,GAAG,cAAc;YACjB,UAAU,EAAE,OAAO,KAAK,kBAAW,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU;SAC7E,CAAC,CAAC;IACJ,CAAC;CACD;AAXD,4DAWC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeDtoProperties, TApiPropertyDescribeObjectProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryObject<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeObjectProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeObjectProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryObject = void 0;
|
|
4
4
|
const object_decorator_1 = require("../../../../../decorator/api/property/object.decorator");
|
|
5
5
|
class DtoPropertyFactoryObject {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { dataType, type, ...restProperties } = metadata;
|
|
8
8
|
return (0, object_decorator_1.ApiPropertyObject)({
|
|
9
9
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/object.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"object.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/object.class.ts"],"names":[],"mappings":";;;AAIA,6FAA2F;AAE3F,MAAa,wBAAwB;IACpC,MAAM,CAAC,QAA8C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC5L,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAyC,QAAQ,CAAC;QAE7F,OAAO,IAAA,oCAAiB,EAAC;YACxB,MAAM;YACN,IAAI,EAAE,QAAQ;YACd,GAAG,MAAM;YACT,GAAG,cAAc;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAXD,4DAWC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeDtoProperties, TApiPropertyDescribeStringProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryString<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeStringProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeStringProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryString = void 0;
|
|
4
4
|
const string_decorator_1 = require("../../../../../decorator/api/property/string.decorator");
|
|
5
5
|
class DtoPropertyFactoryString {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { type, ...restProperties } = metadata;
|
|
8
8
|
return (0, string_decorator_1.ApiPropertyString)({
|
|
9
9
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/string.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"string.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/string.class.ts"],"names":[],"mappings":";;;AAIA,6FAA2F;AAE3F,MAAa,wBAAwB;IACpC,MAAM,CAAC,QAA8C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC5L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAyC,QAAQ,CAAC;QAEnF,OAAO,IAAA,oCAAiB,EAAC;YACxB,MAAM;YACN,GAAG,MAAM;YACT,GAAG,cAAc;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAVD,4DAUC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from "../../../../../enum";
|
|
1
2
|
import type { IApiEntity, IDtoGenerateFactory } from "../../../../../interface";
|
|
2
3
|
import type { TApiPropertyDescribeDtoProperties, TApiPropertyDescribeUuidProperties } from "../../../../../type";
|
|
3
4
|
export declare class DtoPropertyFactoryUuid<E> implements IDtoGenerateFactory<E> {
|
|
4
|
-
create(metadata: TApiPropertyDescribeUuidProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties): PropertyDecorator;
|
|
5
|
+
create(metadata: TApiPropertyDescribeUuidProperties, entity: IApiEntity<E>, config: TApiPropertyDescribeDtoProperties, _method: EApiRouteType, _dtoType: EApiDtoType, _propertyName: string): PropertyDecorator;
|
|
5
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DtoPropertyFactoryUuid = void 0;
|
|
4
4
|
const uuid_decorator_1 = require("../../../../../decorator/api/property/uuid.decorator");
|
|
5
5
|
class DtoPropertyFactoryUuid {
|
|
6
|
-
create(metadata, entity, config) {
|
|
6
|
+
create(metadata, entity, config, _method, _dtoType, _propertyName) {
|
|
7
7
|
const { type, ...restProperties } = metadata;
|
|
8
8
|
return (0, uuid_decorator_1.ApiPropertyUUID)({ entity, ...config, ...restProperties });
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/uuid.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"uuid.class.js","sourceRoot":"","sources":["../../../../../../src/class/utility/dto/property/factory/uuid.class.ts"],"names":[],"mappings":";;;AAIA,yFAAuF;AAEvF,MAAa,sBAAsB;IAClC,MAAM,CAAC,QAA4C,EAAE,MAAqB,EAAE,MAAyC,EAAE,OAAsB,EAAE,QAAqB,EAAE,aAAqB;QAC1L,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAuC,QAAQ,CAAC;QAEjF,OAAO,IAAA,gCAAe,EAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC;IAClE,CAAC;CACD;AAND,wDAMC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CONTROLLER_API_DECORATOR_CONSTANT = void 0;
|
|
4
|
-
const RESERVED_METHOD_PREFIX = "
|
|
4
|
+
const RESERVED_METHOD_PREFIX = "";
|
|
5
5
|
exports.CONTROLLER_API_DECORATOR_CONSTANT = {
|
|
6
6
|
RESERVED_METHOD_PREFIX,
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.constant.js","sourceRoot":"","sources":["../../../../src/constant/decorator/api/controller.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,
|
|
1
|
+
{"version":3,"file":"controller.constant.js","sourceRoot":"","sources":["../../../../src/constant/decorator/api/controller.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,EAAE,CAAC;AAE7B,QAAA,iCAAiC,GAE1C;IACH,sBAAsB;CACb,CAAC"}
|
|
@@ -5,21 +5,6 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
|
-
async function executor(options) {
|
|
9
|
-
const { entity, properties, repository } = options;
|
|
10
|
-
try {
|
|
11
|
-
return await repository.save(properties);
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
if (error instanceof common_1.HttpException) {
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
18
|
-
entity: entity,
|
|
19
|
-
type: enum_1.EErrorStringAction.CREATING_ERROR,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
8
|
function ApiFunctionCreate(properties) {
|
|
24
9
|
const { entity } = properties;
|
|
25
10
|
return function (target, propertyKey, descriptor) {
|
|
@@ -35,4 +20,19 @@ function ApiFunctionCreate(properties) {
|
|
|
35
20
|
return descriptor;
|
|
36
21
|
};
|
|
37
22
|
}
|
|
23
|
+
async function executor(options) {
|
|
24
|
+
const { entity, properties, repository } = options;
|
|
25
|
+
try {
|
|
26
|
+
return await repository.save(properties);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error instanceof common_1.HttpException) {
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
33
|
+
entity: entity,
|
|
34
|
+
type: enum_1.EErrorStringAction.CREATING_ERROR,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
38
|
//# sourceMappingURL=create.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;AAWA,8CAwBC;AA9BD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,SAAgB,iBAAiB,CAA2B,UAAkC;IAC7F,MAAM,EAAE,MAAM,EAAE,GAA2B,UAAU,CAAC;IAEtD,OAAO,UAAU,MAAe,EAAE,WAAmB,EAAE,UAA8B;QACpF,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QAEjB,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAA2C;YAE3C,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wCAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,OAAO,QAAQ,CAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAA2B,OAAgD;IACjG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAA4C,OAAO,CAAC;IAE5F,IAAI,CAAC;QACJ,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,kCAAW,EAAC;YACX,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -6,23 +6,6 @@ const enum_1 = require("../../../enum");
|
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
8
|
const get_decorator_1 = require("./get.decorator");
|
|
9
|
-
async function executor(options) {
|
|
10
|
-
const { criteria, entity, getFunction, repository } = options;
|
|
11
|
-
try {
|
|
12
|
-
const existingEntity = await getFunction({ where: criteria });
|
|
13
|
-
return await repository.remove(existingEntity);
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
console.log(error);
|
|
17
|
-
if (error instanceof common_1.HttpException) {
|
|
18
|
-
throw error;
|
|
19
|
-
}
|
|
20
|
-
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
21
|
-
entity: entity,
|
|
22
|
-
type: enum_1.EErrorStringAction.UPDATING_ERROR,
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
9
|
function ApiFunctionDelete(properties) {
|
|
27
10
|
const { entity } = properties;
|
|
28
11
|
const getDecorator = (0, get_decorator_1.ApiFunctionGet)({ entity });
|
|
@@ -54,4 +37,20 @@ function ApiFunctionDelete(properties) {
|
|
|
54
37
|
return descriptor;
|
|
55
38
|
};
|
|
56
39
|
}
|
|
40
|
+
async function executor(options) {
|
|
41
|
+
const { criteria, entity, getFunction, repository } = options;
|
|
42
|
+
try {
|
|
43
|
+
const existingEntity = await getFunction({ where: criteria });
|
|
44
|
+
return await repository.remove(existingEntity);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof common_1.HttpException) {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
51
|
+
entity: entity,
|
|
52
|
+
type: enum_1.EErrorStringAction.UPDATING_ERROR,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
57
56
|
//# sourceMappingURL=delete.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/delete.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"delete.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/delete.decorator.ts"],"names":[],"mappings":";;AAaA,8CAyCC;AAjDD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,mDAAiD;AAEjD,SAAgB,iBAAiB,CAA2B,UAAkC;IAC7F,MAAM,EAAE,MAAM,EAAE,GAA2B,UAAU,CAAC;IACtD,MAAM,YAAY,GAA6F,IAAA,8BAAc,EAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7I,IAAI,WAAqE,CAAC;IAE1E,OAAO,UAAU,MAAe,EAAE,WAAmB,EAAE,UAA8B;QACpF,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QAEjB,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,QAAuC;YAEvC,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wCAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,CAAC,WAAW,EAAE,CAAC;gBAClB,MAAM,aAAa,GAAsF;oBACxG,KAAK,EAAE;wBACN,OAAO,OAAO,CAAC,MAAM,CAAC,IAAA,wCAAc,EAAC,iBAAiB,CAAC,CAAC,CAAC;oBAC1D,CAAC;iBACD,CAAC;gBACF,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;gBAEzC,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;oBACzB,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9C,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAA,wCAAc,EAAC,wCAAwC,CAAC,CAAC;gBAChE,CAAC;YACF,CAAC;YAED,OAAO,QAAQ,CAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAA2B,OAAgD;IACjG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAA4C,OAAO,CAAC;IAEvG,IAAI,CAAC;QACJ,MAAM,cAAc,GAAM,MAAM,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEjE,OAAO,MAAM,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,kCAAW,EAAC;YACX,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -5,6 +5,19 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
|
+
function ApiFunctionGetList(properties) {
|
|
9
|
+
const { entity } = properties;
|
|
10
|
+
return function (_target, _propertyKey, descriptor) {
|
|
11
|
+
descriptor.value = async function (properties) {
|
|
12
|
+
const repository = this.repository;
|
|
13
|
+
if (!repository) {
|
|
14
|
+
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
15
|
+
}
|
|
16
|
+
return executor({ entity, properties, repository });
|
|
17
|
+
};
|
|
18
|
+
return descriptor;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
8
21
|
async function executor(options) {
|
|
9
22
|
const { entity, properties, repository } = options;
|
|
10
23
|
try {
|
|
@@ -18,7 +31,6 @@ async function executor(options) {
|
|
|
18
31
|
};
|
|
19
32
|
}
|
|
20
33
|
catch (error) {
|
|
21
|
-
console.log("EBANINA", error);
|
|
22
34
|
if (error instanceof common_1.HttpException) {
|
|
23
35
|
throw error;
|
|
24
36
|
}
|
|
@@ -28,17 +40,4 @@ async function executor(options) {
|
|
|
28
40
|
}));
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
|
-
function ApiFunctionGetList(properties) {
|
|
32
|
-
const { entity } = properties;
|
|
33
|
-
return function (_target, _propertyKey, descriptor) {
|
|
34
|
-
descriptor.value = async function (properties) {
|
|
35
|
-
const repository = this.repository;
|
|
36
|
-
if (!repository) {
|
|
37
|
-
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
38
|
-
}
|
|
39
|
-
return executor({ entity, properties, repository });
|
|
40
|
-
};
|
|
41
|
-
return descriptor;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
43
|
//# sourceMappingURL=get-list.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-list.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get-list.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-list.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get-list.decorator.ts"],"names":[],"mappings":";;AAWA,gDAsBC;AA5BD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,SAAgB,kBAAkB,CAA2B,UAAkC;IAC9F,MAAM,EAAE,MAAM,EAAE,GAA2B,UAAU,CAAC;IAGtD,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B;QACtF,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAA4C;YAE5C,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wCAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,OAAO,QAAQ,CAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAA2B,OAAiD;IAClG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAA6C,OAAO,CAAC;IAE7F,IAAI,CAAC;QACJ,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAuB,MAAM,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAE1F,OAAO;YACN,KAAK,EAAE,KAAK,CAAC,MAAM;YAEnB,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7G,KAAK;YACL,UAAU;YAEV,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;SACnD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,kCAAW,EAAC;YACX,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAkB,CAAC,mBAAmB;SAC5C,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -5,6 +5,21 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
|
+
function ApiFunctionGetMany(properties) {
|
|
9
|
+
const { entity } = properties;
|
|
10
|
+
return function (target, propertyKey, descriptor) {
|
|
11
|
+
void target;
|
|
12
|
+
void propertyKey;
|
|
13
|
+
descriptor.value = async function (properties) {
|
|
14
|
+
const repository = this.repository;
|
|
15
|
+
if (!repository) {
|
|
16
|
+
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
17
|
+
}
|
|
18
|
+
return executor({ entity, properties, repository });
|
|
19
|
+
};
|
|
20
|
+
return descriptor;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
8
23
|
async function executor(options) {
|
|
9
24
|
const { entity, properties, repository } = options;
|
|
10
25
|
try {
|
|
@@ -24,19 +39,4 @@ async function executor(options) {
|
|
|
24
39
|
}));
|
|
25
40
|
}
|
|
26
41
|
}
|
|
27
|
-
function ApiFunctionGetMany(properties) {
|
|
28
|
-
const { entity } = properties;
|
|
29
|
-
return function (target, propertyKey, descriptor) {
|
|
30
|
-
void target;
|
|
31
|
-
void propertyKey;
|
|
32
|
-
descriptor.value = async function (properties) {
|
|
33
|
-
const repository = this.repository;
|
|
34
|
-
if (!repository) {
|
|
35
|
-
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
36
|
-
}
|
|
37
|
-
return executor({ entity, properties, repository });
|
|
38
|
-
};
|
|
39
|
-
return descriptor;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
42
|
//# sourceMappingURL=get-many.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-many.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get-many.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-many.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get-many.decorator.ts"],"names":[],"mappings":";;AAYA,gDAwBC;AA9BD,2CAAgG;AAEhG,wC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CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -5,12 +5,25 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
|
+
function ApiFunctionGet(properties) {
|
|
9
|
+
const { entity } = properties;
|
|
10
|
+
return function (target, propertyKey, descriptor) {
|
|
11
|
+
void target;
|
|
12
|
+
void propertyKey;
|
|
13
|
+
descriptor.value = async function (properties) {
|
|
14
|
+
const repository = this.repository;
|
|
15
|
+
if (!repository) {
|
|
16
|
+
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
17
|
+
}
|
|
18
|
+
return executor({ entity, properties, repository });
|
|
19
|
+
};
|
|
20
|
+
return descriptor;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
8
23
|
async function executor(options) {
|
|
9
24
|
const { entity, properties, repository } = options;
|
|
10
25
|
try {
|
|
11
26
|
const item = await repository.findOne(properties);
|
|
12
|
-
console.log("FILTER GET", properties);
|
|
13
|
-
console.log("RESULT GET", item);
|
|
14
27
|
if (!item) {
|
|
15
28
|
throw new common_1.NotFoundException((0, error_string_utility_1.ErrorString)({ entity, type: enum_1.EErrorStringAction.NOT_FOUND }));
|
|
16
29
|
}
|
|
@@ -26,20 +39,4 @@ async function executor(options) {
|
|
|
26
39
|
}));
|
|
27
40
|
}
|
|
28
41
|
}
|
|
29
|
-
function ApiFunctionGet(properties) {
|
|
30
|
-
const { entity } = properties;
|
|
31
|
-
return function (target, propertyKey, descriptor) {
|
|
32
|
-
void target;
|
|
33
|
-
void propertyKey;
|
|
34
|
-
descriptor.value = async function (properties) {
|
|
35
|
-
console.log("ALO BLYAT", properties);
|
|
36
|
-
const repository = this.repository;
|
|
37
|
-
if (!repository) {
|
|
38
|
-
throw (0, error_exception_utility_1.ErrorException)("Repository is not available in this context");
|
|
39
|
-
}
|
|
40
|
-
return executor({ entity, properties, repository });
|
|
41
|
-
};
|
|
42
|
-
return descriptor;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
42
|
//# sourceMappingURL=get.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/get.decorator.ts"],"names":[],"mappings":";;AAWA,wCAwBC;AA9BD,2CAAgG;AAEhG,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,SAAgB,cAAc,CAA2B,UAAkC;IAC1F,MAAM,EAAE,MAAM,EAAE,GAA2B,UAAU,CAAC;IAEtD,OAAO,UAAU,MAAe,EAAE,WAAmB,EAAE,UAA8B;QACpF,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QAEjB,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAAwC;YAExC,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wCAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,OAAO,QAAQ,CAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAA2B,OAA6C;IAC9F,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAyC,OAAO,CAAC;IAEzF,IAAI,CAAC;QACJ,MAAM,IAAI,GAAa,MAAM,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE5D,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,MAAM,IAAI,0BAAiB,CAAC,IAAA,kCAAW,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,kCAAW,EAAC;YACX,MAAM;YACN,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -6,34 +6,6 @@ const enum_1 = require("../../../enum");
|
|
|
6
6
|
const error_exception_utility_1 = require("../../../utility/error-exception.utility");
|
|
7
7
|
const error_string_utility_1 = require("../../../utility/error-string.utility");
|
|
8
8
|
const get_decorator_1 = require("./get.decorator");
|
|
9
|
-
async function executor(options) {
|
|
10
|
-
const { criteria, entity, getFunction, properties, repository } = options;
|
|
11
|
-
try {
|
|
12
|
-
const existingEntity = await getFunction({ where: criteria });
|
|
13
|
-
const updatedProperties = {};
|
|
14
|
-
const typedEntries = Object.entries(properties);
|
|
15
|
-
for (const [key, value] of typedEntries) {
|
|
16
|
-
if (key in existingEntity) {
|
|
17
|
-
updatedProperties[key] = value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const mergedEntity = {
|
|
21
|
-
...existingEntity,
|
|
22
|
-
...updatedProperties,
|
|
23
|
-
};
|
|
24
|
-
return await repository.save(mergedEntity);
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.log(error);
|
|
28
|
-
if (error instanceof common_1.HttpException) {
|
|
29
|
-
throw error;
|
|
30
|
-
}
|
|
31
|
-
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
32
|
-
entity: entity,
|
|
33
|
-
type: enum_1.EErrorStringAction.UPDATING_ERROR,
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
9
|
function ApiFunctionUpdate(properties) {
|
|
38
10
|
const { entity } = properties;
|
|
39
11
|
const getDecorator = (0, get_decorator_1.ApiFunctionGet)({ entity });
|
|
@@ -65,4 +37,31 @@ function ApiFunctionUpdate(properties) {
|
|
|
65
37
|
return descriptor;
|
|
66
38
|
};
|
|
67
39
|
}
|
|
40
|
+
async function executor(options) {
|
|
41
|
+
const { criteria, entity, getFunction, properties, repository } = options;
|
|
42
|
+
try {
|
|
43
|
+
const existingEntity = await getFunction({ where: criteria });
|
|
44
|
+
const updatedProperties = {};
|
|
45
|
+
const typedEntries = Object.entries(properties);
|
|
46
|
+
for (const [key, value] of typedEntries) {
|
|
47
|
+
if (key in existingEntity) {
|
|
48
|
+
updatedProperties[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const mergedEntity = {
|
|
52
|
+
...existingEntity,
|
|
53
|
+
...updatedProperties,
|
|
54
|
+
};
|
|
55
|
+
return await repository.save(mergedEntity);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (error instanceof common_1.HttpException) {
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
throw new common_1.InternalServerErrorException((0, error_string_utility_1.ErrorString)({
|
|
62
|
+
entity: entity,
|
|
63
|
+
type: enum_1.EErrorStringAction.UPDATING_ERROR,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
68
67
|
//# sourceMappingURL=update.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/update.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"update.decorator.js","sourceRoot":"","sources":["../../../../src/decorator/api/function/update.decorator.ts"],"names":[],"mappings":";;AAcA,8CA0CC;AAlDD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,mDAAiD;AA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