@mondart/nestjs-common-module 1.0.3 → 1.0.5

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 (188) hide show
  1. package/dist/caching/caching.module.js.map +1 -1
  2. package/dist/caching/caching.service.js.map +1 -1
  3. package/dist/caching/index.js.map +1 -1
  4. package/dist/constants/index.js.map +1 -1
  5. package/dist/constants/validation-constraints.const.js.map +1 -1
  6. package/dist/controllers/core-crud.controller.d.ts +4 -4
  7. package/dist/controllers/core-crud.controller.js +6 -6
  8. package/dist/controllers/core-crud.controller.js.map +1 -1
  9. package/dist/controllers/index.js.map +1 -1
  10. package/dist/decorators/entity-order.decorator.js.map +1 -1
  11. package/dist/decorators/index.js.map +1 -1
  12. package/dist/decorators/swagger-api-response.decorator.js.map +1 -1
  13. package/dist/decorators/validations/default/array-max-size.decorator.js.map +1 -1
  14. package/dist/decorators/validations/default/array-min-size.decorator.js.map +1 -1
  15. package/dist/decorators/validations/default/array-not-empty.decorator.js.map +1 -1
  16. package/dist/decorators/validations/default/index.js.map +1 -1
  17. package/dist/decorators/validations/default/is-array.decorator.js.map +1 -1
  18. package/dist/decorators/validations/default/is-boolean.decorator.js.map +1 -1
  19. package/dist/decorators/validations/default/is-date.decorator.js.map +1 -1
  20. package/dist/decorators/validations/default/is-enum.decorator.js.map +1 -1
  21. package/dist/decorators/validations/default/is-int.decorator.js.map +1 -1
  22. package/dist/decorators/validations/default/is-not-empty-object.decorator.js.map +1 -1
  23. package/dist/decorators/validations/default/is-not-empty.decorator.js.map +1 -1
  24. package/dist/decorators/validations/default/is-number-string.decorator.js.map +1 -1
  25. package/dist/decorators/validations/default/is-object.decorator.js.map +1 -1
  26. package/dist/decorators/validations/default/is-positive.decorator.js.map +1 -1
  27. package/dist/decorators/validations/default/is-string.decorator.js.map +1 -1
  28. package/dist/decorators/validations/default/is-uuid.decorator.js.map +1 -1
  29. package/dist/decorators/validations/default/matches.decorator.js.map +1 -1
  30. package/dist/decorators/validations/default/max-length.decorator.js.map +1 -1
  31. package/dist/decorators/validations/default/max.decorator.js.map +1 -1
  32. package/dist/decorators/validations/default/min-length.decorator.js.map +1 -1
  33. package/dist/decorators/validations/default/min.decorator.js.map +1 -1
  34. package/dist/decorators/validations/index.js.map +1 -1
  35. package/dist/decorators/validations/is-id.decorator.js.map +1 -1
  36. package/dist/decorators/validations/is-not-empty-string.decorator.js.map +1 -1
  37. package/dist/dto/index.js.map +1 -1
  38. package/dist/dto/request/base-request.dto.js.map +1 -1
  39. package/dist/dto/request/event.dto.js.map +1 -1
  40. package/dist/dto/request/id.dto.js.map +1 -1
  41. package/dist/dto/request/ids.dto.js.map +1 -1
  42. package/dist/dto/request/index.js.map +1 -1
  43. package/dist/dto/response/base-response-with-action-dates.dto.js.map +1 -1
  44. package/dist/dto/response/base-response.dto.js.map +1 -1
  45. package/dist/dto/response/error-response.dto.js.map +1 -1
  46. package/dist/dto/response/index.js.map +1 -1
  47. package/dist/dto/response/kafka-success-response.dto.js.map +1 -1
  48. package/dist/dto/response/success-response.dto.js.map +1 -1
  49. package/dist/dto/response/validation.dto.js.map +1 -1
  50. package/dist/entities/action-dates.entity.js.map +1 -1
  51. package/dist/entities/base.entity.js.map +1 -1
  52. package/dist/entities/index.js.map +1 -1
  53. package/dist/entities/parent.entity.js.map +1 -1
  54. package/dist/enums/environments.enum.js.map +1 -1
  55. package/dist/enums/index.js.map +1 -1
  56. package/dist/enums/shared-messages.enum.js.map +1 -1
  57. package/dist/filters/http-exception.filter.js.map +1 -1
  58. package/dist/filters/index.d.ts +2 -1
  59. package/dist/filters/index.js +3 -15
  60. package/dist/filters/index.js.map +1 -1
  61. package/dist/filters/rpc-exception.filter.js.map +1 -1
  62. package/dist/helper/get-env.helper.js.map +1 -1
  63. package/dist/helper/get-env.js.map +1 -1
  64. package/dist/helper/index.js.map +1 -1
  65. package/dist/helper/message-formatter.helper.js.map +1 -1
  66. package/dist/helper/multi-inheritance.helper.js.map +1 -1
  67. package/dist/helper/multi-inheritance.util.js.map +1 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/interface/core-crud-service.option.js.map +1 -1
  70. package/dist/interface/custom-validation-arguments.interface.js.map +1 -1
  71. package/dist/interface/index.js.map +1 -1
  72. package/dist/interface/kafka-success-response.interfase.js.map +1 -1
  73. package/dist/interface/pagination-query.js.map +1 -1
  74. package/dist/lib/index.js.map +1 -1
  75. package/dist/lib/kafka/constant/consumer.const.js.map +1 -1
  76. package/dist/lib/kafka/constant/kafka.const.js.map +1 -1
  77. package/dist/lib/kafka/index.js.map +1 -1
  78. package/dist/lib/kafka/kafka-admin.service.js.map +1 -1
  79. package/dist/lib/kafka/kafka-consumer.service.js.map +1 -1
  80. package/dist/lib/kafka/kafka-instance.const.js.map +1 -1
  81. package/dist/lib/kafka/kafka-logger.js.map +1 -1
  82. package/dist/lib/kafka/kafka-producer.service.js.map +1 -1
  83. package/dist/lib/kafka/kafka.interface.js.map +1 -1
  84. package/dist/lib/kafka/kafka.module.js.map +1 -1
  85. package/dist/lib/kafka/kafka.provider.js.map +1 -1
  86. package/dist/lib/kafka/kafka.service.js.map +1 -1
  87. package/dist/services/core-crud.service.js.map +1 -1
  88. package/dist/services/index.js.map +1 -1
  89. package/dist/strategy/index.js.map +1 -1
  90. package/dist/strategy/type-orm-naming.strategy.js.map +1 -1
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/dist/validators/does-exist.validator.js.map +1 -1
  93. package/dist/validators/env.validator.js.map +1 -1
  94. package/dist/validators/index.js.map +1 -1
  95. package/dist/validators/is-unique.validator.js.map +1 -1
  96. package/dist/validators/validation-options.js.map +1 -1
  97. package/package.json +2 -2
  98. package/common/caching/caching.module.ts +0 -28
  99. package/common/caching/caching.service.ts +0 -34
  100. package/common/caching/index.ts +0 -2
  101. package/common/constants/index.ts +0 -1
  102. package/common/constants/validation-constraints.const.ts +0 -14
  103. package/common/controllers/core-crud.controller.ts +0 -106
  104. package/common/controllers/index.ts +0 -1
  105. package/common/decorators/entity-order.decorator.ts +0 -19
  106. package/common/decorators/index.ts +0 -2
  107. package/common/decorators/swagger-api-response.decorator.ts +0 -30
  108. package/common/decorators/validations/default/array-max-size.decorator.ts +0 -9
  109. package/common/decorators/validations/default/array-min-size.decorator.ts +0 -9
  110. package/common/decorators/validations/default/array-not-empty.decorator.ts +0 -7
  111. package/common/decorators/validations/default/index.ts +0 -20
  112. package/common/decorators/validations/default/is-array.decorator.ts +0 -7
  113. package/common/decorators/validations/default/is-boolean.decorator.ts +0 -10
  114. package/common/decorators/validations/default/is-date.decorator.ts +0 -10
  115. package/common/decorators/validations/default/is-enum.decorator.ts +0 -9
  116. package/common/decorators/validations/default/is-int.decorator.ts +0 -10
  117. package/common/decorators/validations/default/is-not-empty-object.decorator.ts +0 -15
  118. package/common/decorators/validations/default/is-not-empty.decorator.ts +0 -7
  119. package/common/decorators/validations/default/is-number-string.decorator.ts +0 -12
  120. package/common/decorators/validations/default/is-object.decorator.ts +0 -7
  121. package/common/decorators/validations/default/is-positive.decorator.ts +0 -10
  122. package/common/decorators/validations/default/is-string.decorator.ts +0 -8
  123. package/common/decorators/validations/default/is-uuid.decorator.ts +0 -7
  124. package/common/decorators/validations/default/matches.decorator.ts +0 -13
  125. package/common/decorators/validations/default/max-length.decorator.ts +0 -9
  126. package/common/decorators/validations/default/max.decorator.ts +0 -13
  127. package/common/decorators/validations/default/min-length.decorator.ts +0 -9
  128. package/common/decorators/validations/default/min.decorator.ts +0 -13
  129. package/common/decorators/validations/index.ts +0 -3
  130. package/common/decorators/validations/is-id.decorator.ts +0 -20
  131. package/common/decorators/validations/is-not-empty-string.decorator.ts +0 -14
  132. package/common/dto/index.ts +0 -2
  133. package/common/dto/request/base-request.dto.ts +0 -11
  134. package/common/dto/request/event.dto.ts +0 -25
  135. package/common/dto/request/id.dto.ts +0 -10
  136. package/common/dto/request/ids.dto.ts +0 -13
  137. package/common/dto/request/index.ts +0 -4
  138. package/common/dto/response/base-response-with-action-dates.dto.ts +0 -19
  139. package/common/dto/response/base-response.dto.ts +0 -10
  140. package/common/dto/response/error-response.dto.ts +0 -22
  141. package/common/dto/response/index.ts +0 -5
  142. package/common/dto/response/kafka-success-response.dto.ts +0 -56
  143. package/common/dto/response/success-response.dto.ts +0 -32
  144. package/common/dto/response/validation.dto.ts +0 -80
  145. package/common/entities/action-dates.entity.ts +0 -30
  146. package/common/entities/base.entity.ts +0 -7
  147. package/common/entities/index.ts +0 -2
  148. package/common/entities/parent.entity.ts +0 -35
  149. package/common/enums/environments.enum.ts +0 -6
  150. package/common/enums/index.ts +0 -2
  151. package/common/enums/shared-messages.enum.ts +0 -40
  152. package/common/filters/http-exception.filter.ts +0 -74
  153. package/common/filters/index.ts +0 -1
  154. package/common/filters/rpc-exception.filter.ts +0 -40
  155. package/common/helper/get-env.helper.ts +0 -3
  156. package/common/helper/get-env.ts +0 -3
  157. package/common/helper/index.ts +0 -2
  158. package/common/helper/message-formatter.helper.ts +0 -30
  159. package/common/helper/multi-inheritance.helper.ts +0 -12
  160. package/common/helper/multi-inheritance.util.ts +0 -12
  161. package/common/index.ts +0 -14
  162. package/common/interface/core-crud-service.option.ts +0 -8
  163. package/common/interface/custom-validation-arguments.interface.ts +0 -20
  164. package/common/interface/index.ts +0 -2
  165. package/common/interface/kafka-success-response.interfase.ts +0 -9
  166. package/common/interface/pagination-query.ts +0 -39
  167. package/common/lib/index.ts +0 -1
  168. package/common/lib/kafka/constant/consumer.const.ts +0 -13
  169. package/common/lib/kafka/constant/kafka.const.ts +0 -9
  170. package/common/lib/kafka/index.ts +0 -5
  171. package/common/lib/kafka/kafka-admin.service.ts +0 -51
  172. package/common/lib/kafka/kafka-consumer.service.ts +0 -59
  173. package/common/lib/kafka/kafka-instance.const.ts +0 -9
  174. package/common/lib/kafka/kafka-logger.ts +0 -25
  175. package/common/lib/kafka/kafka-producer.service.ts +0 -97
  176. package/common/lib/kafka/kafka.interface.ts +0 -22
  177. package/common/lib/kafka/kafka.module.ts +0 -80
  178. package/common/lib/kafka/kafka.provider.ts +0 -10
  179. package/common/lib/kafka/kafka.service.ts +0 -224
  180. package/common/services/core-crud.service.ts +0 -457
  181. package/common/services/index.ts +0 -1
  182. package/common/strategy/index.ts +0 -1
  183. package/common/strategy/type-orm-naming.strategy.ts +0 -17
  184. package/common/validators/does-exist.validator.ts +0 -42
  185. package/common/validators/env.validator.ts +0 -28
  186. package/common/validators/index.ts +0 -4
  187. package/common/validators/is-unique.validator.ts +0 -70
  188. package/common/validators/validation-options.ts +0 -38
@@ -1 +1 @@
1
- {"version":3,"file":"does-exist.validator.js","sourceRoot":"","sources":["../../common/validators/does-exist.validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAGyB;AACzB,qCAAqC;AAErC,2CAA4C;AAC5C,6CAAmD;AAU5C,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YAEU,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAC7B,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,mBAAwC;QACpE,MAAM,UAAU,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAW,CAAC;QAChE,MAAM,cAAc,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE;gBACL,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,KAAK;oBACrE,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC;aAC5B;SACF,CAAC,CAAqB,CAAC;QAExB,IAAI,MAAM,EAAE,EAAE,KAAK,KAAK,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QAC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file":"env.validator.js","sourceRoot":"","sources":["../../src/validators/env.validator.ts"],"names":[],"mappings":";;AAGA,oCAcC;AAED,4CAkBC;AArCD,yDAAiD;AACjD,qDAA+C;AAE/C,SAAgB,YAAY,CAC1B,aAAsC,EACtC,iBAAsB;IAEtB,MAAM,WAAW,GAAW,IAAA,gCAAY,EAAC,iBAAiB,EAAE,aAAa,EAAE;QACzE,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,WAAW,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAgB,gBAAgB,CAC9B,aAAsC,EACtC,qBAA0B;IAE1B,MAAM,WAAW,GAAW,IAAA,gCAAY,EACtC,qBAAqB,EACrB,aAAa,EACb;QACE,wBAAwB,EAAE,IAAI;KAC/B,CACF,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,WAAW,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../common/validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,kDAAgC;AAChC,wDAAsC;AACtC,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAA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,CAC3D,CAAC,SAAiB,EAAE,EAAE;YACpB,YAAY,GAAG;gBACb,GAAG,YAAY;gBACf,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC;aACrD,CAAC;QACJ,CAAC,CACF,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE;gBACL,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,KAAK;oBACrE,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC;gBAC3B,GAAG,UAAU;aACd;SACF,CAAC,CAAqB,CAAC;QAExB,IAAI,MAAM,EAAE,EAAE,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA9CY,4BAAQ;mBAAR,QAAQ;IAFpB,IAAA,mBAAU,GAAE;IACZ,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAGlD,WAAA,IAAA,0BAAgB,GAAE,CAAA;qCACC,oBAAU;GAHrB,QAAQ,CA8CpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"validation-options.js","sourceRoot":"","sources":["../../common/validators/validation-options.ts"],"names":[],"mappings":";;AAAA,2CAKwB;AACxB,iFAAsE;AAEtE,SAAS,mBAAmB,CAAC,MAAyB;IACpD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACrC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW;YACnC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;iBAC7B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,2CAAgB,CAAC,OAAO,CAAC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CAAC;YACpB,WAAW,IAAI,mBAAmB,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,MAAM,iBAAiB,GAA0B;IAC/C,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,mBAAmB,EAAE,mBAAU,CAAC,oBAAoB;IACpD,gBAAgB,EAAE,CAAC,MAAyB,EAAE,EAAE,CAC9C,IAAI,sBAAa,CACf;QACE,MAAM,EAAE,mBAAU,CAAC,oBAAoB;QACvC,OAAO,EAAE,sBAAsB,MAAM,CAAC,MAAM,eAAe;QAC3D,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC;KACrC,EACD,mBAAU,CAAC,oBAAoB,CAChC;CACJ,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@mondart/nestjs-common-module",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "author": {
6
6
  "name": "Mondart"
7
7
  },
8
- "main": "common/index.js",
8
+ "main": "dist/index.js",
9
9
  "private": false,
10
10
  "license": "MIT",
11
11
  "scripts": {
@@ -1,28 +0,0 @@
1
- import { Global, Module } from '@nestjs/common';
2
- import { CachingService } from './caching.service';
3
- import { CacheModule } from '@nestjs/cache-manager';
4
- import { ConfigModule, ConfigService } from '@nestjs/config';
5
- import * as redisStore from 'cache-manager-redis-store';
6
-
7
- @Global()
8
- @Module({
9
- imports: [
10
- CacheModule.register({
11
- isGlobal: true,
12
- imports: [ConfigModule],
13
- useFactory: async (configService: ConfigService) => ({
14
- ttl: configService.get('CACHE_TTL', 86400000),
15
- store: redisStore,
16
- host: configService.get('redis.host'),
17
- port: configService.get('redis.port'),
18
- password: configService.get('redis.password'),
19
- max: 10000,
20
- isGlobal: true,
21
- }),
22
- inject: [ConfigService],
23
- }),
24
- ],
25
- providers: [CachingService],
26
- exports: [CachingService],
27
- })
28
- export class CachingModule {}
@@ -1,34 +0,0 @@
1
- import { Inject, Injectable } from '@nestjs/common';
2
- import { CACHE_MANAGER } from '@nestjs/cache-manager';
3
- import { Cache } from 'cache-manager';
4
-
5
- @Injectable()
6
- export class CachingService {
7
- constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache) {}
8
-
9
- getRedisClient() {
10
- return this.cacheManager.store;
11
- }
12
-
13
- async get<T>(key: string) {
14
- const result: string = await this.cacheManager.get<undefined | string>(key);
15
- // JSON parse result
16
- if (result) {
17
- return JSON.parse(result) as T;
18
- }
19
- return result as T;
20
- }
21
-
22
- async set<T>(key: string, value: T, ttlSeconds: number): Promise<void> {
23
- // stringify value
24
- return await this.cacheManager.set(
25
- key,
26
- JSON.stringify(value),
27
- ttlSeconds * 1000,
28
- );
29
- }
30
-
31
- async del(key: string): Promise<void> {
32
- return await this.cacheManager.del(key);
33
- }
34
- }
@@ -1,2 +0,0 @@
1
- export * from './caching.module';
2
- export * from './caching.service';
@@ -1 +0,0 @@
1
- export * from './validation-constraints.const';
@@ -1,14 +0,0 @@
1
- export class ValidationConstraints {
2
- static readonly maxIntegerValue = 2147483646;
3
- static readonly pageLimit = 50;
4
- static readonly otpCodeLength = 6;
5
- static readonly minSortFieldLength = 2;
6
- static readonly maxSortFieldLength = 32;
7
- static readonly shebaNumberLength = 26;
8
- static readonly ticketMessageMinLength = 50;
9
- static readonly ticketMessageMaxLength = 500;
10
- static readonly trackingCodeLength = 8;
11
- static readonly phonePattern = /^(?![1-9]).{11}$/;
12
- static readonly faxPattern = /^\+?[0-9]{6,}$/;
13
- static readonly postalCodeLength = 10;
14
- }
@@ -1,106 +0,0 @@
1
- import {
2
- Get,
3
- Post,
4
- Body,
5
- Put,
6
- Param,
7
- Delete,
8
- NotFoundException,
9
- HttpStatus,
10
- BadRequestException,
11
- } from '@nestjs/common';
12
- import { Paginate, Paginated } from 'nestjs-paginate';
13
- import { PaginateConfig } from 'nestjs-paginate/lib/paginate';
14
- import { PaginationQueryCustom } from '../interface/pagination-query';
15
- import { SharedMessages } from '../enums/shared-messages.enum';
16
- import { SuccessResponse } from '../dto/response/success-response.dto';
17
- import { BaseResponseWithActionDates } from '../dto/response/base-response-with-action-dates.dto';
18
- import { IdDto } from '../dto/request/id.dto';
19
- import { CoreCrudService } from '../services/core-crud.service';
20
- import { ParentEntity } from '../entities/parent.entity';
21
-
22
- export class CoreCrudController<
23
- T extends ParentEntity,
24
- CreateDto,
25
- UpdateDto,
26
- ResponseDto extends BaseResponseWithActionDates,
27
- > {
28
- protected constructor(
29
- protected readonly coreService: CoreCrudService<T, CreateDto, UpdateDto>,
30
- protected readonly responseDto: any,
31
- ) {}
32
-
33
- async findAll(
34
- @Paginate() query: PaginationQueryCustom,
35
- paginateConfig: PaginateConfig<T>,
36
- ): Promise<Paginated<T>> {
37
- const response = await this.coreService.findAllWithPagination(
38
- query,
39
- paginateConfig,
40
- );
41
- if (!response) throw new NotFoundException(SharedMessages.FETCH_FAILED);
42
-
43
- response.data = response.data.map((item) => new this.responseDto(item));
44
- return response;
45
- }
46
-
47
- async findOneById(id: number): Promise<SuccessResponse<ResponseDto>> {
48
- const response = await this.coreService.findOneById(id);
49
- if (!response)
50
- throw new NotFoundException(SharedMessages.RESOURCE_NOT_FOUND);
51
-
52
- return new SuccessResponse<ResponseDto>(
53
- new this.responseDto(response),
54
- SharedMessages.SUCCESSFUL,
55
- HttpStatus.OK,
56
- );
57
- }
58
-
59
- async create(createDto: CreateDto): Promise<SuccessResponse<ResponseDto>> {
60
- const response = await this.coreService.create(createDto);
61
- if (!response) throw new BadRequestException(SharedMessages.CREATE_FAILED);
62
-
63
- return new SuccessResponse<ResponseDto>(
64
- new this.responseDto(response),
65
- SharedMessages.SUCCESSFUL,
66
- HttpStatus.CREATED,
67
- );
68
- }
69
-
70
- async update(
71
- { id }: IdDto,
72
- updateDto: UpdateDto,
73
- ): Promise<SuccessResponse<ResponseDto>> {
74
- const response = await this.coreService.update(id, updateDto);
75
- if (!response) throw new BadRequestException(SharedMessages.UPDATE_FAILED);
76
-
77
- const foundItem = await this.coreService.findOneById(id);
78
- return new SuccessResponse<ResponseDto>(
79
- new this.responseDto(foundItem),
80
- SharedMessages.SUCCESSFUL,
81
- HttpStatus.OK,
82
- );
83
- }
84
-
85
- async delete({ id }: IdDto): Promise<SuccessResponse<void>> {
86
- const result = await this.coreService.deleteById(id);
87
- if (!result) throw new BadRequestException(SharedMessages.DELETE_FAILED);
88
-
89
- return new SuccessResponse<void>(
90
- undefined,
91
- SharedMessages.SUCCESSFUL,
92
- HttpStatus.OK,
93
- );
94
- }
95
-
96
- async softDelete({ id }: IdDto): Promise<SuccessResponse<void>> {
97
- const result = await this.coreService.softDeleteById(id);
98
- if (!result) throw new BadRequestException(SharedMessages.DELETE_FAILED);
99
-
100
- return new SuccessResponse<void>(
101
- undefined,
102
- SharedMessages.SUCCESSFUL,
103
- HttpStatus.OK,
104
- );
105
- }
106
- }
@@ -1 +0,0 @@
1
- export * from './core-crud.controller';
@@ -1,19 +0,0 @@
1
- const ORDER_KEY = Symbol.for('order_key');
2
- export function Order(value: number): PropertyDecorator {
3
- return (target, propertyKey) => {
4
- Reflect.defineMetadata(ORDER_KEY, value, target, propertyKey);
5
- };
6
- }
7
-
8
- export function getOrder(
9
- target: unknown,
10
- propertyKey: string | symbol,
11
- defaultVal = 0,
12
- ) {
13
- const result = Reflect.getMetadata(ORDER_KEY, target, propertyKey);
14
- if (typeof result === 'number') {
15
- return result;
16
- }
17
-
18
- return defaultVal;
19
- }
@@ -1,2 +0,0 @@
1
- export * from './validations';
2
- export * from './swagger-api-response.decorator';
@@ -1,30 +0,0 @@
1
- import { applyDecorators } from '@nestjs/common';
2
- import { getSchemaPath } from '@nestjs/swagger';
3
- import { SuccessResponse } from '../dto/response/success-response.dto';
4
- import { ApiResponse } from '@nestjs/swagger';
5
-
6
- export function CustomApiResponse(options: {
7
- status: number;
8
- description: string;
9
- responseDto: any;
10
- }) {
11
- // Return a function that NestJS will call to apply the decorator
12
- return function (target: any, key?: string, descriptor?: PropertyDescriptor) {
13
- // Use applyDecorators to handle combining with other potential decorators
14
- return applyDecorators(
15
- ApiResponse({
16
- status: options.status, // Typically CREATED status
17
- description: options.description,
18
- schema: {
19
- $ref: getSchemaPath(SuccessResponse),
20
- type: 'object',
21
- properties: {
22
- data: {
23
- $ref: getSchemaPath(options.responseDto),
24
- },
25
- },
26
- },
27
- }),
28
- )(target, key, descriptor);
29
- };
30
- }
@@ -1,9 +0,0 @@
1
- import { ArrayMaxSize as arrayMaxSize } from 'class-validator';
2
-
3
- export function ArrayMaxSize(length: number): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- arrayMaxSize(length, {
6
- message: 'validation.ARRAY_MAX_SIZE',
7
- })(target, propertyKey);
8
- };
9
- }
@@ -1,9 +0,0 @@
1
- import { ArrayMinSize as arrayMinSize } from 'class-validator';
2
-
3
- export function ArrayMinSize(length: number): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- arrayMinSize(length, {
6
- message: 'validation.ARRAY_MIN_SIZE',
7
- })(target, propertyKey);
8
- };
9
- }
@@ -1,7 +0,0 @@
1
- import { ArrayNotEmpty as arrayNotEmpty } from 'class-validator';
2
-
3
- export function ArrayNotEmpty(): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- arrayNotEmpty({ message: 'validation.NOT_EMPTY' })(target, propertyKey);
6
- };
7
- }
@@ -1,20 +0,0 @@
1
- export * from './is-string.decorator';
2
- export * from './is-not-empty.decorator';
3
- export * from './min-length.decorator';
4
- export * from './max-length.decorator';
5
- export * from './is-enum.decorator';
6
- export * from './is-int.decorator';
7
- export * from './is-positive.decorator';
8
- export * from './min.decorator';
9
- export * from './max.decorator';
10
- export * from './is-array.decorator';
11
- export * from './matches.decorator';
12
- export * from './is-number-string.decorator';
13
- export * from './is-boolean.decorator';
14
- export * from './is-uuid.decorator';
15
- export * from './is-object.decorator';
16
- export * from './is-date.decorator';
17
- export * from './array-not-empty.decorator';
18
- export * from './array-min-size.decorator';
19
- export * from './array-max-size.decorator';
20
- export * from './is-not-empty-object.decorator';
@@ -1,7 +0,0 @@
1
- import { IsArray as isArray } from 'class-validator';
2
-
3
- export function IsArray(): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isArray({ message: 'validation.ARRAY' })(target, propertyKey);
6
- };
7
- }
@@ -1,10 +0,0 @@
1
- import { IsBoolean as isBoolean } from 'class-validator';
2
-
3
- export function IsBoolean(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isBoolean(Object.assign({ message: 'validation.BOOLEAN' }, options))(
6
- target,
7
- propertyKey,
8
- );
9
- };
10
- }
@@ -1,10 +0,0 @@
1
- import { IsDate as isDate } from 'class-validator';
2
-
3
- export function IsDate(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isDate(Object.assign({ message: 'validation.DATE' }, options))(
6
- target,
7
- propertyKey,
8
- );
9
- };
10
- }
@@ -1,9 +0,0 @@
1
- import { IsEnum as isEnum } from 'class-validator';
2
-
3
- export function IsEnum(value: any): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isEnum(value, {
6
- message: 'validation.ENUM',
7
- })(target, propertyKey);
8
- };
9
- }
@@ -1,10 +0,0 @@
1
- import { IsInt as isInt } from 'class-validator';
2
-
3
- export function IsInt(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isInt(Object.assign({ message: 'validation.INT' }, options))(
6
- target,
7
- propertyKey,
8
- );
9
- };
10
- }
@@ -1,15 +0,0 @@
1
- import { IsNotEmptyObject as isNotEmptyObject } from 'class-validator';
2
-
3
- export function IsNotEmptyObject(
4
- params: {
5
- nullable?: boolean;
6
- },
7
- options?: { each?: boolean },
8
- ): PropertyDecorator {
9
- return function (target: any, propertyKey: string | symbol): void {
10
- isNotEmptyObject(params, {
11
- ...options,
12
- message: 'validation.IS_NOT_EMPTY_OBJECT',
13
- })(target, propertyKey);
14
- };
15
- }
@@ -1,7 +0,0 @@
1
- import { IsNotEmpty as isNotEmpty } from 'class-validator';
2
-
3
- export function IsNotEmpty(): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isNotEmpty({ message: 'validation.NOT_EMPTY' })(target, propertyKey);
6
- };
7
- }
@@ -1,12 +0,0 @@
1
- import { IsNumberString as isNumberString } from 'class-validator';
2
-
3
- export function IsNumberString(options?: {
4
- each?: boolean;
5
- }): PropertyDecorator {
6
- return function (target: any, propertyKey: string | symbol): void {
7
- isNumberString(
8
- {},
9
- Object.assign({ message: 'validation.NUMBER_STRING' }, options),
10
- )(target, propertyKey);
11
- };
12
- }
@@ -1,7 +0,0 @@
1
- import { ValidationOptions, IsObject as isObject } from 'class-validator';
2
-
3
- export function IsObject(options?: ValidationOptions): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isObject({ ...options, message: 'validation.OBJECT' })(target, propertyKey);
6
- };
7
- }
@@ -1,10 +0,0 @@
1
- import { IsPositive as isPositive } from 'class-validator';
2
-
3
- export function IsPositive(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isPositive(Object.assign({ message: 'validation.POSITIVE' }, options))(
6
- target,
7
- propertyKey,
8
- );
9
- };
10
- }
@@ -1,8 +0,0 @@
1
- import { IsString as isString } from 'class-validator';
2
-
3
- export function IsString(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- const each = (options && options.each) || false;
6
- isString({ each, message: 'validation.STRING' })(target, propertyKey);
7
- };
8
- }
@@ -1,7 +0,0 @@
1
- import { IsUUID as isUUID } from 'class-validator';
2
-
3
- export function IsUUID(options?: { each?: boolean }): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- isUUID(4, options)(target, propertyKey);
6
- };
7
- }
@@ -1,13 +0,0 @@
1
- import { Matches as matches } from 'class-validator';
2
-
3
- export function Matches(
4
- pattern,
5
- options?: { each?: boolean },
6
- ): PropertyDecorator {
7
- return function (target: any, propertyKey: string | symbol): void {
8
- matches(pattern, Object.assign({ message: 'validation.PATTERN' }, options))(
9
- target,
10
- propertyKey,
11
- );
12
- };
13
- }
@@ -1,9 +0,0 @@
1
- import { MaxLength as maxLength } from 'class-validator';
2
-
3
- export function MaxLength(length: number): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- maxLength(length, {
6
- message: 'validation.MAX_LENGTH',
7
- })(target, propertyKey);
8
- };
9
- }
@@ -1,13 +0,0 @@
1
- import { Max as max } from 'class-validator';
2
-
3
- export function Max(
4
- value: number,
5
- options?: { each?: boolean },
6
- ): PropertyDecorator {
7
- return function (target: any, propertyKey: string | symbol): void {
8
- max(value, Object.assign({ message: 'validation.MAX' }, options))(
9
- target,
10
- propertyKey,
11
- );
12
- };
13
- }
@@ -1,9 +0,0 @@
1
- import { MinLength as minLength } from 'class-validator';
2
-
3
- export function MinLength(length: number): PropertyDecorator {
4
- return function (target: any, propertyKey: string | symbol): void {
5
- minLength(length, {
6
- message: 'validation.MIN_LENGTH',
7
- })(target, propertyKey);
8
- };
9
- }
@@ -1,13 +0,0 @@
1
- import { Min as min } from 'class-validator';
2
-
3
- export function Min(
4
- value: number,
5
- options?: { each?: boolean },
6
- ): PropertyDecorator {
7
- return function (target: any, propertyKey: string | symbol): void {
8
- min(value, Object.assign({ message: 'validation.MIN' }, options))(
9
- target,
10
- propertyKey,
11
- );
12
- };
13
- }
@@ -1,3 +0,0 @@
1
- export * from './default';
2
- export * from './is-id.decorator';
3
- export * from './is-not-empty-string.decorator';
@@ -1,20 +0,0 @@
1
- import { IsOptional } from 'class-validator';
2
- import { IsInt, IsNotEmpty, IsPositive, Max } from './default';
3
- import { ValidationConstraints } from '../../constants/validation-constraints.const';
4
-
5
- export function IsId(options?: {
6
- optional?: boolean;
7
- each?: boolean;
8
- }): PropertyDecorator {
9
- return function (target: any, propertyKey: string | symbol): void {
10
- const each = (options && options.each) || false;
11
- IsInt({ each })(target, propertyKey);
12
- IsPositive({ each })(target, propertyKey);
13
- Max(ValidationConstraints.maxIntegerValue, {
14
- each,
15
- })(target, propertyKey);
16
-
17
- if (options && options.optional) IsOptional()(target, propertyKey);
18
- else IsNotEmpty()(target, propertyKey);
19
- };
20
- }
@@ -1,14 +0,0 @@
1
- import { IsOptional } from 'class-validator';
2
- import { IsNotEmpty, IsString } from './default';
3
-
4
- export function CustomIsString(options?: {
5
- each?: boolean;
6
- optional: boolean;
7
- }): PropertyDecorator {
8
- return function (target: any, propertyKey: string | symbol): void {
9
- IsString({ each: options ? options.each : false })(target, propertyKey);
10
-
11
- if (options && options.optional) IsOptional()(target, propertyKey);
12
- else IsNotEmpty()(target, propertyKey);
13
- };
14
- }
@@ -1,2 +0,0 @@
1
- export * from './request';
2
- export * from './response';
@@ -1,11 +0,0 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import { IsBoolean, IsOptional } from 'class-validator';
3
-
4
- export class BaseRequest {
5
- @ApiProperty({ example: false })
6
- @IsBoolean()
7
- @IsOptional()
8
- isActive?: boolean;
9
-
10
- metadata?: any;
11
- }
@@ -1,25 +0,0 @@
1
- import { IsNumber, IsOptional, IsString } from 'class-validator';
2
-
3
- export class EventDto<T> {
4
- @IsString()
5
- @IsOptional()
6
- topic?: string;
7
-
8
- @IsString()
9
- event_source: string;
10
-
11
- @IsString()
12
- @IsOptional()
13
- model?: string;
14
-
15
- @IsString()
16
- @IsOptional()
17
- event_key?: string;
18
-
19
- @IsOptional()
20
- data?: T;
21
-
22
- @IsNumber()
23
- @IsOptional()
24
- partition?: number;
25
- }