@elsikora/nestjs-crud-automator 1.5.4 → 1.6.0

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.
Files changed (62) hide show
  1. package/dist/decorator/api/function/create.decorator.js +15 -15
  2. package/dist/decorator/api/function/create.decorator.js.map +1 -1
  3. package/dist/decorator/api/function/delete.decorator.js +16 -17
  4. package/dist/decorator/api/function/delete.decorator.js.map +1 -1
  5. package/dist/decorator/api/function/get-list.decorator.js +13 -14
  6. package/dist/decorator/api/function/get-list.decorator.js.map +1 -1
  7. package/dist/decorator/api/function/get-many.decorator.js +15 -15
  8. package/dist/decorator/api/function/get-many.decorator.js.map +1 -1
  9. package/dist/decorator/api/function/get.decorator.js +15 -18
  10. package/dist/decorator/api/function/get.decorator.js.map +1 -1
  11. package/dist/decorator/api/function/update.decorator.js +27 -28
  12. package/dist/decorator/api/function/update.decorator.js.map +1 -1
  13. package/dist/decorator/api/method.decorator.js +64 -2
  14. package/dist/decorator/api/method.decorator.js.map +1 -1
  15. package/dist/decorator/api/property/boolean.decorator.js +41 -43
  16. package/dist/decorator/api/property/boolean.decorator.js.map +1 -1
  17. package/dist/decorator/api/property/date.decorator.js +102 -104
  18. package/dist/decorator/api/property/date.decorator.js.map +1 -1
  19. package/dist/decorator/api/property/enum.decorator.js +41 -44
  20. package/dist/decorator/api/property/enum.decorator.js.map +1 -1
  21. package/dist/decorator/api/property/number.decorator.js +105 -105
  22. package/dist/decorator/api/property/number.decorator.js.map +1 -1
  23. package/dist/decorator/api/property/object.decorator.js +41 -43
  24. package/dist/decorator/api/property/object.decorator.js.map +1 -1
  25. package/dist/decorator/api/property/string.decorator.js +101 -103
  26. package/dist/decorator/api/property/string.decorator.js.map +1 -1
  27. package/dist/decorator/api/property/uuid.decorator.js +37 -39
  28. package/dist/decorator/api/property/uuid.decorator.js.map +1 -1
  29. package/dist/enum/decorator/api/action.enum.d.ts +17 -1
  30. package/dist/enum/decorator/api/action.enum.js +16 -0
  31. package/dist/enum/decorator/api/action.enum.js.map +1 -1
  32. package/dist/enum/exception.enum.d.ts +18 -18
  33. package/dist/enum/exception.enum.js +17 -17
  34. package/dist/enum/exception.enum.js.map +1 -1
  35. package/dist/enum/filter-operation.enum.d.ts +31 -31
  36. package/dist/enum/filter-operation.enum.js +58 -58
  37. package/dist/enum/filter-operation.enum.js.map +1 -1
  38. package/dist/enum/index.d.ts +1 -1
  39. package/dist/enum/index.js +1 -1
  40. package/dist/enum/index.js.map +1 -1
  41. package/dist/enum/utility/error-string-action.enum.d.ts +44 -2
  42. package/dist/enum/utility/error-string-action.enum.js +43 -1
  43. package/dist/enum/utility/error-string-action.enum.js.map +1 -1
  44. package/dist/factory/api/controller.factory.d.ts +3 -3
  45. package/dist/factory/api/controller.factory.js +20 -26
  46. package/dist/factory/api/controller.factory.js.map +1 -1
  47. package/dist/package.json +26 -26
  48. package/dist/utility/api/controller/apply-decorators.utility.js +0 -2
  49. package/dist/utility/api/controller/apply-decorators.utility.js.map +1 -1
  50. package/dist/utility/api/controller/apply-metadata.utility.js +0 -1
  51. package/dist/utility/api/controller/apply-metadata.utility.js.map +1 -1
  52. package/dist/utility/api/controller/transform-data.utility.js +45 -45
  53. package/dist/utility/api/controller/transform-data.utility.js.map +1 -1
  54. package/dist/utility/camel-case-string.utility.js +14 -2
  55. package/dist/utility/camel-case-string.utility.js.map +1 -1
  56. package/dist/utility/dto/generate.utility.js.map +1 -1
  57. package/dist/utility/dto/is-property-exposed-for-guard.utility.js +0 -2
  58. package/dist/utility/dto/is-property-exposed-for-guard.utility.js.map +1 -1
  59. package/dist/utility/is-error-of-type.utility.js +19 -19
  60. package/dist/utility/is-error-of-type.utility.js.map +1 -1
  61. package/dist/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -1
  62. package/package.json +26 -26
@@ -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":";;AA8BA,8CAwBC;AAjDD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,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;AAED,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"}
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":";;AAoCA,8CAyCC;AAxED,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,mDAAiD;AAEjD,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,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,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;AAED,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"}
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,EAA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,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":";;AA0CA,gDAsBC;AA3DD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,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,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAE9B,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;AAED,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"}
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":";;AAqCA,gDAwBC;AAvDD,2CAAgG;AAEhG,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,KAAK,UAAU,QAAQ,CAA2B,OAAiD;IAClG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAA6C,OAAO,CAAC;IAE7F,IAAI,CAAC;QACJ,MAAM,KAAK,GAAa,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,0BAAiB,CAAC,IAAA,kCAAW,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,KAAK,CAAC;IACd,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;AAED,SAAgB,kBAAkB,CAA2B,UAAkC;IAC9F,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,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"}
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,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,SAAgB,kBAAkB,CAA2B,UAAkC;IAC9F,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,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,KAAK,GAAa,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,0BAAiB,CAAC,IAAA,kCAAW,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,KAAK,CAAC;IACd,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"}
@@ -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":";;AAsCA,wCAyBC;AA1DD,2CAAgG;AAEhG,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,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,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAChC,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;AAED,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,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YACrC,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"}
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":";;AAoDA,8CA0CC;AAxFD,2CAA6E;AAE7E,wCAAmD;AACnD,sFAA0E;AAC1E,gFAAoE;AAEpE,mDAAiD;AAEjD,KAAK,UAAU,QAAQ,CAA2B,OAAgD;IACjG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,GAA4C,OAAO,CA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M,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,UAAU,EAAE,CAAC,CAAC;QAC/E,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC"}
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;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;Q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AAC;QAE9G,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;YACzC,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;gBAC3B,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAChC,CAAC;QACF,CAAC;QAED,MAAM,YAAY,GAAmB;YACpC,GAAG,cAAc;YACjB,GAAG,iBAAiB;SACpB,CAAC;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,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"}
@@ -10,10 +10,26 @@ function ApiMethod(options) {
10
10
  let summary = "";
11
11
  if (options.action) {
12
12
  switch (options.action) {
13
+ case enum_1.EApiAction.ARCHIVE: {
14
+ summary = `Archiving \`${options.entity.name}\``;
15
+ break;
16
+ }
13
17
  case enum_1.EApiAction.AUTHENTICATION: {
14
18
  summary = `Authentication of \`${options.entity.name}\``;
15
19
  break;
16
20
  }
21
+ case enum_1.EApiAction.BULK_CREATE: {
22
+ summary = `Bulk creating \`${options.entity.name}s\``;
23
+ break;
24
+ }
25
+ case enum_1.EApiAction.BULK_DELETE: {
26
+ summary = `Bulk deleting \`${options.entity.name}s\``;
27
+ break;
28
+ }
29
+ case enum_1.EApiAction.BULK_UPDATE: {
30
+ summary = `Bulk updating \`${options.entity.name}s\``;
31
+ break;
32
+ }
17
33
  case enum_1.EApiAction.CONFIRMATION: {
18
34
  summary = `Confirmation of \`${options.entity.name}\``;
19
35
  break;
@@ -26,6 +42,18 @@ function ApiMethod(options) {
26
42
  summary = `Deleting \`${options.entity.name}\``;
27
43
  break;
28
44
  }
45
+ case enum_1.EApiAction.DOWNLOAD: {
46
+ summary = `Downloading \`${options.entity.name}\``;
47
+ break;
48
+ }
49
+ case enum_1.EApiAction.DUPLICATE: {
50
+ summary = `Duplicating \`${options.entity.name}\``;
51
+ break;
52
+ }
53
+ case enum_1.EApiAction.EXPORT: {
54
+ summary = `Exporting \`${options.entity.name}\``;
55
+ break;
56
+ }
29
57
  case enum_1.EApiAction.FETCH: {
30
58
  summary = `Fetching \`${options.entity.name}\``;
31
59
  break;
@@ -42,6 +70,14 @@ function ApiMethod(options) {
42
70
  summary = `Fetching \`${options.entity.name}\` of specified item`;
43
71
  break;
44
72
  }
73
+ case enum_1.EApiAction.IMPORT: {
74
+ summary = `Importing \`${options.entity.name}\``;
75
+ break;
76
+ }
77
+ case enum_1.EApiAction.LOGOUT: {
78
+ summary = `Logout of \`${options.entity.name}\``;
79
+ break;
80
+ }
45
81
  case enum_1.EApiAction.PARTIAL_UPDATE: {
46
82
  summary = `Partial updating \`${options.entity.name}\``;
47
83
  break;
@@ -54,10 +90,38 @@ function ApiMethod(options) {
54
90
  summary = `Registration of \`${options.entity.name}\``;
55
91
  break;
56
92
  }
93
+ case enum_1.EApiAction.RESTORE: {
94
+ summary = `Restoring \`${options.entity.name}\``;
95
+ break;
96
+ }
97
+ case enum_1.EApiAction.SEARCH: {
98
+ summary = `Searching for \`${options.entity.name}\``;
99
+ break;
100
+ }
101
+ case enum_1.EApiAction.SUBSCRIBE: {
102
+ summary = `Subscribing to \`${options.entity.name}\``;
103
+ break;
104
+ }
105
+ case enum_1.EApiAction.UNSUBSCRIBE: {
106
+ summary = `Unsubscribing from \`${options.entity.name}\``;
107
+ break;
108
+ }
57
109
  case enum_1.EApiAction.UPDATE: {
58
110
  summary = `Updating \`${options.entity.name}\``;
59
111
  break;
60
112
  }
113
+ case enum_1.EApiAction.UPLOAD: {
114
+ summary = `Uploading \`${options.entity.name}\``;
115
+ break;
116
+ }
117
+ case enum_1.EApiAction.VALIDATE: {
118
+ summary = `Validating \`${options.entity.name}\``;
119
+ break;
120
+ }
121
+ case enum_1.EApiAction.VERIFY: {
122
+ summary = `Verifying \`${options.entity.name}\``;
123
+ break;
124
+ }
61
125
  }
62
126
  }
63
127
  if (!options.description && options.action) {
@@ -190,13 +254,11 @@ function ApiMethod(options) {
190
254
  if (options.authentication) {
191
255
  if (options.authentication?.bearerStrategies?.length) {
192
256
  for (const strategy of options.authentication?.bearerStrategies) {
193
- console.log("Applying bearer strategy", strategy);
194
257
  decorators.push((0, swagger_1.ApiBearerAuth)(strategy));
195
258
  }
196
259
  }
197
260
  if (options.authentication?.securityStrategies?.length) {
198
261
  for (const strategy of options.authentication.securityStrategies) {
199
- console.log("Applying security strategy", strategy);
200
262
  decorators.push((0, swagger_1.ApiSecurity)(strategy));
201
263
  }
202
264
  }
@@ -1 +1 @@
1
- {"version":3,"file":"method.decorator.js","sourceRoot":"","sources":["../../../src/decorator/api/method.decorator.ts"],"names":[],"mappings":";;AASA,8BAwRC;AA/RD,2CAAgI;AAChI,6CAA+O;AAC/O,iDAA6C;AAE7C,qCAAwC;AACxC,6FAAoF;AAEpF,SAAgB,SAAS,CAA2B,OAAgC;IACnF,IAAI,OAAO,GAAW,EAAE,CAAC;IAEzB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,KAAK,iBAAU,CAAC,cAAc,CAAC,CAAC,CAAC;gBAChC,OAAO,GAAG,uBAAuB,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;gBAEzD,MAAM;YACP,CAAC;YAED,KAAK,iBAAU,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9B,OAAO,GAAG,qBAAqB,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;gBAEvD,MAAM;YACP,CAAC;YAED,KAAK,iBAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBACxB,OAAO,GAA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AC;QAED,KAAK,sBAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,IAAA,YAAG,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YAEnC,MAAM;QACP,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,CAAC,MAAM,mBAAmB,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;IAED,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC5B,IAAI,OAAO,CAAC,cAAc,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;YACtD,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,cAAc,EAAE,gBAAgB,EAAE,CAAC;gBACjE,UAAU,CAAC,IAAI,CAAC,IAAA,uBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC;YAC1C,CAAC;QACF,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;YACxD,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;gBAClE,UAAU,CAAC,IAAI,CAAC,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACvC,CAAC"}
@@ -12,35 +12,13 @@ function ApiPropertyBoolean(properties) {
12
12
  const decorators = buildDecorators(properties, apiPropertyOptions);
13
13
  return (0, common_1.applyDecorators)(...decorators);
14
14
  }
15
- function validateOptions(properties) {
16
- const errors = [];
17
- if (properties.isArray === true) {
18
- if (properties.minItems > properties.maxItems) {
19
- errors.push("'minItems' is greater than 'maxItems'");
20
- }
21
- if (properties.minItems < 0) {
22
- errors.push("'minItems' is less than 0");
23
- }
24
- if (properties.maxItems < 0) {
25
- errors.push("'maxItems' is less than 0");
26
- }
27
- if (properties.isUniqueItems && properties.maxItems <= 1) {
28
- errors.push("'uniqueItems' is true but 'maxItems' is less than or equal to 1");
29
- }
30
- }
31
- if (errors.length > 0) {
32
- throw new Error(`ApiPropertyBoolean error: ${errors.join("\n")}`);
33
- }
34
- }
35
15
  function buildApiPropertyOptions(properties) {
36
16
  const apiPropertyOptions = {
37
17
  description: `${properties.entity.name} ${properties.description || ""}`,
38
18
  nullable: properties.isNullable,
39
19
  type: enum_1.EApiPropertyDataType.BOOLEAN,
40
20
  };
41
- if (properties.isResponse === false || properties.isResponse === undefined) {
42
- apiPropertyOptions.required = properties.isRequired;
43
- }
21
+ apiPropertyOptions.required = properties.isResponse === false || properties.isResponse === undefined ? properties.isRequired : false;
44
22
  if (properties.isArray) {
45
23
  apiPropertyOptions.isArray = true;
46
24
  apiPropertyOptions.minItems = properties.minItems;
@@ -53,16 +31,16 @@ function buildApiPropertyOptions(properties) {
53
31
  }
54
32
  return apiPropertyOptions;
55
33
  }
56
- function buildResponseDecorators(properties) {
34
+ function buildDecorators(properties, apiPropertyOptions) {
35
+ const decorators = [(0, swagger_1.ApiProperty)(apiPropertyOptions)];
36
+ decorators.push(...buildResponseDecorators(properties), ...buildRequestDecorators(properties), ...buildFormatDecorators(properties), ...buildTransformDecorators(properties));
37
+ return decorators;
38
+ }
39
+ function buildFormatDecorators(properties) {
57
40
  const decorators = [];
58
- if (properties.isResponse) {
59
- decorators.push((0, swagger_1.ApiResponseProperty)());
60
- if (properties.isExpose === undefined || properties.isExpose) {
61
- decorators.push((0, class_transformer_1.Expose)());
62
- }
63
- else {
64
- decorators.push((0, class_transformer_1.Exclude)());
65
- }
41
+ const isArray = properties.isArray ?? false;
42
+ if (properties.isResponse === undefined || !properties.isResponse) {
43
+ decorators.push((0, class_validator_1.IsBoolean)({ each: isArray }));
66
44
  }
67
45
  return decorators;
68
46
  }
@@ -81,6 +59,19 @@ function buildRequestDecorators(properties) {
81
59
  }
82
60
  return decorators;
83
61
  }
62
+ function buildResponseDecorators(properties) {
63
+ const decorators = [];
64
+ if (properties.isResponse) {
65
+ decorators.push((0, swagger_1.ApiResponseProperty)());
66
+ if (properties.isExpose === undefined || properties.isExpose) {
67
+ decorators.push((0, class_transformer_1.Expose)());
68
+ }
69
+ else {
70
+ decorators.push((0, class_transformer_1.Exclude)());
71
+ }
72
+ }
73
+ return decorators;
74
+ }
84
75
  function buildTransformDecorators(properties) {
85
76
  const decorators = [];
86
77
  if (!properties.isResponse) {
@@ -148,17 +139,24 @@ function buildTransformDecorators(properties) {
148
139
  }
149
140
  return decorators;
150
141
  }
151
- function buildFormatDecorators(properties) {
152
- const decorators = [];
153
- const isArray = properties.isArray ?? false;
154
- if (properties.isResponse === undefined || !properties.isResponse) {
155
- decorators.push((0, class_validator_1.IsBoolean)({ each: isArray }));
142
+ function validateOptions(properties) {
143
+ const errors = [];
144
+ if (properties.isArray === true) {
145
+ if (properties.minItems > properties.maxItems) {
146
+ errors.push("'minItems' is greater than 'maxItems'");
147
+ }
148
+ if (properties.minItems < 0) {
149
+ errors.push("'minItems' is less than 0");
150
+ }
151
+ if (properties.maxItems < 0) {
152
+ errors.push("'maxItems' is less than 0");
153
+ }
154
+ if (properties.isUniqueItems && properties.maxItems <= 1) {
155
+ errors.push("'uniqueItems' is true but 'maxItems' is less than or equal to 1");
156
+ }
157
+ }
158
+ if (errors.length > 0) {
159
+ throw new Error(`ApiPropertyBoolean error: ${errors.join("\n")}`);
156
160
  }
157
- return decorators;
158
- }
159
- function buildDecorators(properties, apiPropertyOptions) {
160
- const decorators = [(0, swagger_1.ApiProperty)(apiPropertyOptions)];
161
- decorators.push(...buildResponseDecorators(properties), ...buildRequestDecorators(properties), ...buildFormatDecorators(properties), ...buildTransformDecorators(properties));
162
- return decorators;
163
161
  }
164
162
  //# sourceMappingURL=boolean.decorator.js.map