itlab-internal-services 2.15.7 → 2.16.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.
Files changed (371) hide show
  1. package/README.md +1 -187
  2. package/dist/classes/document-merger.class.js +2 -3
  3. package/dist/classes/index.d.ts +4 -1
  4. package/dist/classes/index.js +7 -3
  5. package/dist/classes/report-category.class.d.ts +55 -0
  6. package/dist/classes/report-category.class.js +120 -0
  7. package/dist/classes/schema-builder.class.d.ts +75 -0
  8. package/dist/classes/schema-builder.class.js +109 -0
  9. package/dist/classes/task-manager.class.d.ts +71 -0
  10. package/dist/classes/task-manager.class.js +99 -0
  11. package/dist/decorators/{account.decorator.d.ts → authenticated-account.decorator.d.ts} +4 -4
  12. package/dist/decorators/{account.decorator.js → authenticated-account.decorator.js} +8 -10
  13. package/dist/decorators/index.d.ts +1 -1
  14. package/dist/decorators/index.js +1 -1
  15. package/dist/exceptions/authenticated-user-required.exception.d.ts +34 -0
  16. package/dist/exceptions/authenticated-user-required.exception.js +51 -0
  17. package/dist/exceptions/bad-body.exception.d.ts +19 -8
  18. package/dist/exceptions/bad-body.exception.js +26 -10
  19. package/dist/exceptions/bad-parameter.exception.d.ts +23 -8
  20. package/dist/exceptions/bad-parameter.exception.js +41 -18
  21. package/dist/exceptions/duplicate.exception.d.ts +20 -8
  22. package/dist/exceptions/duplicate.exception.js +27 -10
  23. package/dist/exceptions/index.d.ts +1 -0
  24. package/dist/exceptions/index.js +1 -0
  25. package/dist/functions/add-views-likes-virtuals.function.d.ts +15 -0
  26. package/dist/functions/add-views-likes-virtuals.function.js +43 -0
  27. package/dist/functions/create-internal-axios-client.function.js +2 -2
  28. package/dist/functions/index.d.ts +1 -0
  29. package/dist/functions/index.js +3 -1
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +5 -5
  32. package/dist/interceptors/attribute-sanitizer.interceptor.d.ts +68 -0
  33. package/dist/interceptors/attribute-sanitizer.interceptor.js +154 -0
  34. package/dist/interceptors/index.d.ts +1 -0
  35. package/dist/interceptors/index.js +17 -0
  36. package/dist/middleware/http-logging.middleware.d.ts +19 -0
  37. package/dist/middleware/http-logging.middleware.js +50 -0
  38. package/dist/middleware/index.d.ts +1 -0
  39. package/dist/middleware/index.js +17 -0
  40. package/dist/models/account.model.d.ts +23 -0
  41. package/dist/models/account.model.js +59 -0
  42. package/dist/models/index.d.ts +3 -1
  43. package/dist/models/index.js +7 -3
  44. package/dist/{modules/search/models → models}/search-document.model.d.ts +1 -1
  45. package/dist/{modules/search/models → models}/search-document.model.js +1 -1
  46. package/dist/models/{account-entity.model.d.ts → user.model.d.ts} +8 -21
  47. package/dist/models/{account-entity.model.js → user.model.js} +11 -25
  48. package/dist/modules/authentication/authentication-module-options.interface.d.ts +2 -8
  49. package/dist/modules/authentication/authentication-options.parameter.d.ts +4 -0
  50. package/dist/modules/authentication/{inject-auth-options.decorator.js → authentication-options.parameter.js} +5 -2
  51. package/dist/modules/authentication/authentication.module.d.ts +23 -0
  52. package/dist/modules/authentication/authentication.module.js +24 -1
  53. package/dist/modules/authentication/guards/index.d.ts +2 -2
  54. package/dist/modules/authentication/guards/index.js +7 -7
  55. package/dist/modules/authentication/guards/jwt-auth.guard.d.ts +17 -0
  56. package/dist/modules/authentication/guards/jwt-auth.guard.js +67 -0
  57. package/dist/modules/authentication/guards/permissions.guard.d.ts +5 -27
  58. package/dist/modules/authentication/guards/permissions.guard.js +27 -59
  59. package/dist/modules/authentication/guards/public.guard.d.ts +7 -13
  60. package/dist/modules/authentication/guards/public.guard.js +10 -24
  61. package/dist/modules/authentication/guards/service-auth.guard.d.ts +22 -0
  62. package/dist/modules/authentication/guards/service-auth.guard.js +65 -0
  63. package/dist/modules/authentication/index.d.ts +3 -3
  64. package/dist/modules/authentication/index.js +3 -5
  65. package/dist/modules/cache/cache-response.interceptor.d.ts +2 -2
  66. package/dist/modules/cache/cache-response.interceptor.js +2 -2
  67. package/dist/modules/cache/index.d.ts +1 -0
  68. package/dist/modules/cache/index.js +1 -0
  69. package/dist/modules/comment/comment-module-options.interface.d.ts +38 -0
  70. package/dist/modules/comment/comment.controller.d.ts +24 -30
  71. package/dist/modules/comment/comment.controller.js +59 -61
  72. package/dist/modules/comment/comment.module-definition.d.ts +1 -42
  73. package/dist/modules/comment/comment.module-definition.js +1 -2
  74. package/dist/modules/comment/comment.module.d.ts +13 -13
  75. package/dist/modules/comment/comment.module.js +15 -42
  76. package/dist/modules/comment/comment.service.d.ts +27 -37
  77. package/dist/modules/comment/comment.service.js +50 -84
  78. package/dist/modules/comment/index.d.ts +2 -3
  79. package/dist/modules/comment/index.js +16 -7
  80. package/dist/modules/database/database.module.js +2 -5
  81. package/dist/modules/database/index.d.ts +2 -5
  82. package/dist/modules/database/index.js +17 -9
  83. package/dist/modules/index.d.ts +2 -6
  84. package/dist/modules/index.js +2 -6
  85. package/dist/modules/like/index.d.ts +2 -1
  86. package/dist/modules/like/index.js +16 -3
  87. package/dist/modules/like/like-module-options.interface.d.ts +21 -0
  88. package/dist/modules/like/like.controller.d.ts +45 -37
  89. package/dist/modules/like/like.controller.js +117 -102
  90. package/dist/modules/like/like.module-definition.d.ts +1 -17
  91. package/dist/modules/like/like.module-definition.js +1 -2
  92. package/dist/modules/like/like.module.d.ts +12 -12
  93. package/dist/modules/like/like.module.js +14 -37
  94. package/dist/modules/like/like.service.d.ts +31 -27
  95. package/dist/modules/like/like.service.js +42 -35
  96. package/dist/modules/merge/index.d.ts +3 -0
  97. package/dist/modules/merge/index.js +19 -0
  98. package/dist/modules/merge/merge-module-options.interface.d.ts +21 -0
  99. package/dist/modules/merge/merge.controller.d.ts +30 -0
  100. package/dist/modules/merge/merge.controller.js +76 -0
  101. package/dist/modules/merge/merge.module.d.ts +18 -0
  102. package/dist/modules/merge/merge.module.js +41 -0
  103. package/dist/modules/merge/merge.service.interface.d.ts +17 -0
  104. package/dist/modules/services/base-http.service.d.ts +83 -0
  105. package/dist/modules/services/base-http.service.js +124 -0
  106. package/dist/modules/services/base-urls.d.ts +22 -0
  107. package/dist/modules/services/base-urls.js +121 -0
  108. package/dist/modules/services/index.d.ts +4 -0
  109. package/dist/modules/services/index.js +20 -0
  110. package/dist/modules/services/providers/accounts.service.d.ts +52 -0
  111. package/dist/modules/services/providers/accounts.service.js +84 -0
  112. package/dist/modules/services/providers/books.service.d.ts +29 -0
  113. package/dist/modules/services/providers/books.service.js +55 -0
  114. package/dist/modules/services/providers/changelog.service.d.ts +18 -0
  115. package/dist/modules/services/providers/changelog.service.js +43 -0
  116. package/dist/modules/services/providers/comments/comments.service-definition.d.ts +1 -0
  117. package/dist/modules/services/providers/comments/comments.service-definition.js +4 -0
  118. package/dist/modules/services/providers/comments/comments.service.d.ts +60 -0
  119. package/dist/modules/services/providers/comments/comments.service.js +139 -0
  120. package/dist/modules/services/providers/comments/index.d.ts +1 -0
  121. package/dist/{factories → modules/services/providers/comments}/index.js +1 -1
  122. package/dist/modules/services/providers/content/content-return-types.d.ts +19 -0
  123. package/dist/modules/services/providers/content/content-return-types.js +7 -0
  124. package/dist/modules/services/providers/content/content.service-definition.d.ts +1 -0
  125. package/dist/modules/services/providers/content/content.service-definition.js +4 -0
  126. package/dist/modules/services/providers/content/content.service.d.ts +96 -0
  127. package/dist/modules/services/providers/content/content.service.js +231 -0
  128. package/dist/modules/services/providers/content/index.d.ts +2 -0
  129. package/dist/modules/{search/models → services/providers/content}/index.js +1 -1
  130. package/dist/modules/services/providers/demo-hive.service.d.ts +29 -0
  131. package/dist/modules/services/providers/demo-hive.service.js +55 -0
  132. package/dist/modules/services/providers/events.service.d.ts +29 -0
  133. package/dist/modules/services/providers/events.service.js +55 -0
  134. package/dist/modules/services/providers/hackschool.service.d.ts +49 -0
  135. package/dist/modules/services/providers/hackschool.service.js +79 -0
  136. package/dist/modules/services/providers/ideas.service.d.ts +18 -0
  137. package/dist/modules/services/providers/ideas.service.js +43 -0
  138. package/dist/modules/services/providers/index.d.ts +19 -0
  139. package/dist/modules/services/providers/index.js +35 -0
  140. package/dist/modules/services/providers/lunch-roulette.service.d.ts +18 -0
  141. package/dist/modules/services/providers/lunch-roulette.service.js +43 -0
  142. package/dist/modules/services/providers/mail/index.d.ts +3 -0
  143. package/dist/modules/services/providers/mail/index.js +19 -0
  144. package/dist/modules/services/providers/mail/mail-types.d.ts +30 -0
  145. package/dist/modules/services/providers/mail/mail-types.js +22 -0
  146. package/dist/modules/services/providers/mail/mail.service.d.ts +99 -0
  147. package/dist/modules/{mail → services/providers/mail}/mail.service.js +55 -92
  148. package/dist/modules/services/providers/newletter.service.d.ts +29 -0
  149. package/dist/modules/services/providers/newletter.service.js +55 -0
  150. package/dist/modules/services/providers/newsroom.service.d.ts +47 -0
  151. package/dist/modules/services/providers/newsroom.service.js +73 -0
  152. package/dist/modules/services/providers/notification/dtos/schedule-notification.dto.js +2 -0
  153. package/dist/modules/services/providers/notification/index.d.ts +2 -0
  154. package/dist/modules/services/providers/notification/index.js +18 -0
  155. package/dist/modules/services/providers/notification/notification.service-definition.d.ts +1 -0
  156. package/dist/modules/services/providers/notification/notification.service-definition.js +4 -0
  157. package/dist/modules/services/providers/notification/notification.service.d.ts +50 -0
  158. package/dist/modules/services/providers/notification/notification.service.js +130 -0
  159. package/dist/modules/services/providers/pass/dtos/create-guild-member-pass.dto.js +2 -0
  160. package/dist/modules/services/providers/pass/dtos/create-team-member-pass.dto.js +2 -0
  161. package/dist/modules/services/providers/pass/index.d.ts +2 -0
  162. package/dist/modules/services/providers/pass/index.js +18 -0
  163. package/dist/modules/services/providers/pass/pass-types.d.ts +18 -0
  164. package/dist/modules/services/providers/pass/pass-types.js +7 -0
  165. package/dist/modules/{pass → services/providers/pass}/pass.service.d.ts +15 -39
  166. package/dist/modules/{pass → services/providers/pass}/pass.service.js +46 -61
  167. package/dist/modules/services/providers/podcasts.service.d.ts +29 -0
  168. package/dist/modules/services/providers/podcasts.service.js +55 -0
  169. package/dist/modules/services/providers/search/dtos/index-search-document.dto.js +2 -0
  170. package/dist/modules/services/providers/search/index.d.ts +2 -0
  171. package/dist/modules/services/providers/search/index.js +18 -0
  172. package/dist/modules/services/providers/search/search.service-definition.d.ts +1 -0
  173. package/dist/modules/services/providers/search/search.service-definition.js +4 -0
  174. package/dist/modules/services/providers/search/search.service.d.ts +66 -0
  175. package/dist/modules/services/providers/search/search.service.js +171 -0
  176. package/dist/modules/services/providers/team.service.d.ts +29 -0
  177. package/dist/modules/services/providers/team.service.js +55 -0
  178. package/dist/modules/services/providers/tech-radar.service.d.ts +39 -0
  179. package/dist/modules/services/providers/tech-radar.service.js +67 -0
  180. package/dist/modules/services/services-module-options.interface.d.ts +4 -0
  181. package/dist/modules/services/services-module-options.interface.js +2 -0
  182. package/dist/modules/services/services-options.parameter.d.ts +1 -0
  183. package/dist/modules/services/services-options.parameter.js +8 -0
  184. package/dist/modules/services/services.module-definition.d.ts +16 -0
  185. package/dist/modules/services/services.module-definition.js +21 -0
  186. package/dist/modules/services/services.module.d.ts +17 -0
  187. package/dist/modules/services/services.module.js +63 -0
  188. package/dist/pipes/index.d.ts +2 -3
  189. package/dist/pipes/index.js +2 -3
  190. package/dist/pipes/params/hub-id.pipe.d.ts +22 -0
  191. package/dist/pipes/{hub-id.pipe.js → params/hub-id.pipe.js} +14 -17
  192. package/dist/pipes/params/hub-resource.pipe.d.ts +22 -0
  193. package/dist/pipes/{hub-resource.pipe.js → params/hub-resource.pipe.js} +19 -20
  194. package/dist/pipes/params/index.d.ts +3 -0
  195. package/dist/pipes/params/index.js +19 -0
  196. package/dist/pipes/params/mongo-id.pipe.d.ts +15 -0
  197. package/dist/pipes/params/mongo-id.pipe.js +52 -0
  198. package/dist/pipes/queries/index.d.ts +3 -0
  199. package/dist/pipes/queries/index.js +19 -0
  200. package/dist/pipes/queries/mongo-ids.pipe.d.ts +22 -0
  201. package/dist/pipes/queries/mongo-ids.pipe.js +60 -0
  202. package/dist/pipes/queries/optional-boolean.pipe.d.ts +29 -0
  203. package/dist/pipes/queries/optional-boolean.pipe.js +72 -0
  204. package/dist/pipes/queries/optional-include-drafts.pipe.d.ts +28 -0
  205. package/dist/pipes/queries/optional-include-drafts.pipe.js +38 -0
  206. package/dist/properties/content-return-type.property.d.ts +7 -0
  207. package/dist/properties/content-return-type.property.js +22 -0
  208. package/dist/properties/index.d.ts +4 -0
  209. package/dist/properties/index.js +11 -0
  210. package/dist/properties/likeable.properties.d.ts +1 -0
  211. package/dist/properties/likeable.properties.js +66 -0
  212. package/dist/properties/viewable.properties.d.ts +1 -0
  213. package/dist/properties/viewable.properties.js +66 -0
  214. package/dist/swagger/index.d.ts +1 -0
  215. package/dist/swagger/index.js +5 -0
  216. package/dist/swagger/remove-public-route-auth.plugin.d.ts +9 -0
  217. package/dist/swagger/remove-public-route-auth.plugin.js +25 -0
  218. package/dist/swagger/swagger-options.interface.d.ts +14 -0
  219. package/dist/swagger/swagger-options.interface.js +2 -0
  220. package/dist/swagger/swagger.function.d.ts +11 -0
  221. package/dist/swagger/swagger.function.js +47 -0
  222. package/dist/transform/boolean.transform.js +3 -3
  223. package/dist/types/index.d.ts +2 -0
  224. package/dist/types/index.js +18 -0
  225. package/dist/types/likeable.type.d.ts +15 -0
  226. package/dist/types/likeable.type.js +2 -0
  227. package/dist/types/viewable.type.d.ts +15 -0
  228. package/dist/types/viewable.type.js +2 -0
  229. package/package.json +2 -2
  230. package/dist/classes/document-updater.class.d.ts +0 -39
  231. package/dist/classes/document-updater.class.js +0 -57
  232. package/dist/factories/index.d.ts +0 -1
  233. package/dist/factories/virtuals.factory.d.ts +0 -79
  234. package/dist/factories/virtuals.factory.js +0 -171
  235. package/dist/http-logger.middleware.d.ts +0 -12
  236. package/dist/http-logger.middleware.js +0 -43
  237. package/dist/likeable.interface.d.ts +0 -41
  238. package/dist/likeable.interface.js +0 -48
  239. package/dist/modules/authentication/guards/auth.guard.d.ts +0 -36
  240. package/dist/modules/authentication/guards/auth.guard.js +0 -107
  241. package/dist/modules/authentication/guards/internal.guard.d.ts +0 -33
  242. package/dist/modules/authentication/guards/internal.guard.js +0 -72
  243. package/dist/modules/authentication/inject-auth-options.decorator.d.ts +0 -1
  244. package/dist/modules/comment/comment.model.d.ts +0 -29
  245. package/dist/modules/comment/comment.model.js +0 -43
  246. package/dist/modules/content/content.module-definition.d.ts +0 -5
  247. package/dist/modules/content/content.module-definition.js +0 -8
  248. package/dist/modules/content/content.module.d.ts +0 -31
  249. package/dist/modules/content/content.module.js +0 -60
  250. package/dist/modules/content/content.service.d.ts +0 -50
  251. package/dist/modules/content/content.service.js +0 -145
  252. package/dist/modules/content/index.d.ts +0 -3
  253. package/dist/modules/content/index.js +0 -9
  254. package/dist/modules/database/model-service/dbs/hub-account.db.d.ts +0 -28
  255. package/dist/modules/database/model-service/dbs/hub-account.db.js +0 -44
  256. package/dist/modules/database/model-service/dbs/hub-books.db.d.ts +0 -23
  257. package/dist/modules/database/model-service/dbs/hub-books.db.js +0 -45
  258. package/dist/modules/database/model-service/dbs/hub-comments.db.d.ts +0 -29
  259. package/dist/modules/database/model-service/dbs/hub-comments.db.js +0 -68
  260. package/dist/modules/database/model-service/dbs/hub-content.db.d.ts +0 -24
  261. package/dist/modules/database/model-service/dbs/hub-content.db.js +0 -49
  262. package/dist/modules/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
  263. package/dist/modules/database/model-service/dbs/hub-demo-hive.db.js +0 -45
  264. package/dist/modules/database/model-service/dbs/hub-events.db.d.ts +0 -24
  265. package/dist/modules/database/model-service/dbs/hub-events.db.js +0 -49
  266. package/dist/modules/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
  267. package/dist/modules/database/model-service/dbs/hub-hackschool.db.js +0 -106
  268. package/dist/modules/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
  269. package/dist/modules/database/model-service/dbs/hub-newsroom.db.js +0 -53
  270. package/dist/modules/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
  271. package/dist/modules/database/model-service/dbs/hub-podcasts.db.js +0 -45
  272. package/dist/modules/database/model-service/dbs/hub-team.db.d.ts +0 -22
  273. package/dist/modules/database/model-service/dbs/hub-team.db.js +0 -41
  274. package/dist/modules/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
  275. package/dist/modules/database/model-service/dbs/hub-tech-radar.db.js +0 -81
  276. package/dist/modules/database/model-service/model.service.d.ts +0 -6407
  277. package/dist/modules/database/model-service/model.service.js +0 -136
  278. package/dist/modules/database/populate-service/populate.service.d.ts +0 -73
  279. package/dist/modules/database/populate-service/populate.service.js +0 -163
  280. package/dist/modules/database/service-mapper-service/service-mapper.service.d.ts +0 -32
  281. package/dist/modules/database/service-mapper-service/service-mapper.service.js +0 -73
  282. package/dist/modules/fetch/fetch.module.d.ts +0 -31
  283. package/dist/modules/fetch/fetch.module.js +0 -60
  284. package/dist/modules/fetch/fetch.service.d.ts +0 -153
  285. package/dist/modules/fetch/fetch.service.js +0 -274
  286. package/dist/modules/fetch/index.d.ts +0 -2
  287. package/dist/modules/fetch/index.js +0 -7
  288. package/dist/modules/mail/index.d.ts +0 -4
  289. package/dist/modules/mail/index.js +0 -23
  290. package/dist/modules/mail/mail.module.d.ts +0 -31
  291. package/dist/modules/mail/mail.module.js +0 -60
  292. package/dist/modules/mail/mail.service.d.ts +0 -136
  293. package/dist/modules/notification/index.d.ts +0 -3
  294. package/dist/modules/notification/index.js +0 -22
  295. package/dist/modules/notification/notification.module-definition.d.ts +0 -5
  296. package/dist/modules/notification/notification.module-definition.js +0 -8
  297. package/dist/modules/notification/notification.module.d.ts +0 -34
  298. package/dist/modules/notification/notification.module.js +0 -63
  299. package/dist/modules/notification/notification.service.d.ts +0 -42
  300. package/dist/modules/notification/notification.service.js +0 -100
  301. package/dist/modules/pass/index.d.ts +0 -3
  302. package/dist/modules/pass/index.js +0 -22
  303. package/dist/modules/pass/pass.module.d.ts +0 -32
  304. package/dist/modules/pass/pass.module.js +0 -61
  305. package/dist/modules/search/index.d.ts +0 -4
  306. package/dist/modules/search/index.js +0 -23
  307. package/dist/modules/search/models/index.d.ts +0 -1
  308. package/dist/modules/search/search.module-definition.d.ts +0 -5
  309. package/dist/modules/search/search.module-definition.js +0 -8
  310. package/dist/modules/search/search.module.d.ts +0 -33
  311. package/dist/modules/search/search.module.js +0 -62
  312. package/dist/modules/search/search.service.d.ts +0 -49
  313. package/dist/modules/search/search.service.js +0 -120
  314. package/dist/pipes/hub-id.pipe.d.ts +0 -22
  315. package/dist/pipes/hub-resource.pipe.d.ts +0 -22
  316. package/dist/pipes/mongo-id.pipe.d.ts +0 -14
  317. package/dist/pipes/mongo-id.pipe.js +0 -52
  318. package/dist/swagger.config.d.ts +0 -36
  319. package/dist/swagger.config.js +0 -76
  320. package/dist/viewable.interface.d.ts +0 -41
  321. package/dist/viewable.interface.js +0 -48
  322. /package/dist/modules/{mail/dtos/auth-login-token-mail.dto.js → comment/comment-module-options.interface.js} +0 -0
  323. /package/dist/modules/{mail/dtos/auth-password-reset-mail.dto.js → like/like-module-options.interface.js} +0 -0
  324. /package/dist/modules/{mail/dtos/event-cancel-mail.dto.js → merge/merge-module-options.interface.js} +0 -0
  325. /package/dist/modules/{mail/dtos/event-invite-mail.dto.js → merge/merge.service.interface.js} +0 -0
  326. /package/dist/modules/{mail → services/providers/mail}/dtos/auth-login-token-mail.dto.d.ts +0 -0
  327. /package/dist/modules/{mail/dtos/idea-status-updated-mail.dto.js → services/providers/mail/dtos/auth-login-token-mail.dto.js} +0 -0
  328. /package/dist/modules/{mail → services/providers/mail}/dtos/auth-password-reset-mail.dto.d.ts +0 -0
  329. /package/dist/modules/{mail/dtos/idea-submitted-mail.dto.js → services/providers/mail/dtos/auth-password-reset-mail.dto.js} +0 -0
  330. /package/dist/modules/{mail → services/providers/mail}/dtos/event-cancel-mail.dto.d.ts +0 -0
  331. /package/dist/modules/{mail/dtos/lunch-roulette-cancel-mail.dto.js → services/providers/mail/dtos/event-cancel-mail.dto.js} +0 -0
  332. /package/dist/modules/{mail → services/providers/mail}/dtos/event-invite-mail.dto.d.ts +0 -0
  333. /package/dist/modules/{mail/dtos/lunch-roulette-matched-mail.dto.js → services/providers/mail/dtos/event-invite-mail.dto.js} +0 -0
  334. /package/dist/modules/{mail → services/providers/mail}/dtos/idea-status-updated-mail.dto.d.ts +0 -0
  335. /package/dist/modules/{mail/dtos/lunch-roulette-submitted-mail.dto.js → services/providers/mail/dtos/idea-status-updated-mail.dto.js} +0 -0
  336. /package/dist/modules/{mail → services/providers/mail}/dtos/idea-submitted-mail.dto.d.ts +0 -0
  337. /package/dist/modules/{mail/dtos/lunch-roulette-unmatched-mail.dto.js → services/providers/mail/dtos/idea-submitted-mail.dto.js} +0 -0
  338. /package/dist/modules/{mail → services/providers/mail}/dtos/index.d.ts +0 -0
  339. /package/dist/modules/{mail → services/providers/mail}/dtos/index.js +0 -0
  340. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-cancel-mail.dto.d.ts +0 -0
  341. /package/dist/modules/{mail/dtos/newsletter-issue-mail.dto.js → services/providers/mail/dtos/lunch-roulette-cancel-mail.dto.js} +0 -0
  342. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-matched-mail.dto.d.ts +0 -0
  343. /package/dist/modules/{mail/dtos/newsletter-subscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-matched-mail.dto.js} +0 -0
  344. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-submitted-mail.dto.d.ts +0 -0
  345. /package/dist/modules/{mail/dtos/newsletter-unsubscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-submitted-mail.dto.js} +0 -0
  346. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-unmatched-mail.dto.d.ts +0 -0
  347. /package/dist/modules/{mail/dtos/notification-mail.dto.js → services/providers/mail/dtos/lunch-roulette-unmatched-mail.dto.js} +0 -0
  348. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-issue-mail.dto.d.ts +0 -0
  349. /package/dist/modules/{notification/dtos/schedule-notification.dto.js → services/providers/mail/dtos/newsletter-issue-mail.dto.js} +0 -0
  350. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-subscribed-mail.dto.d.ts +0 -0
  351. /package/dist/modules/{pass/dtos/create-guild-member-pass.dto.js → services/providers/mail/dtos/newsletter-subscribed-mail.dto.js} +0 -0
  352. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-unsubscribed-mail.dto.d.ts +0 -0
  353. /package/dist/modules/{pass/dtos/create-team-member-pass.dto.js → services/providers/mail/dtos/newsletter-unsubscribed-mail.dto.js} +0 -0
  354. /package/dist/modules/{mail → services/providers/mail}/dtos/notification-mail.dto.d.ts +0 -0
  355. /package/dist/modules/{search/dtos/index-search-document.dto.js → services/providers/mail/dtos/notification-mail.dto.js} +0 -0
  356. /package/dist/modules/{mail → services/providers/mail}/models/index.d.ts +0 -0
  357. /package/dist/modules/{mail → services/providers/mail}/models/index.js +0 -0
  358. /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.d.ts +0 -0
  359. /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.js +0 -0
  360. /package/dist/modules/{notification → services/providers/notification}/dtos/index.d.ts +0 -0
  361. /package/dist/modules/{notification → services/providers/notification}/dtos/index.js +0 -0
  362. /package/dist/modules/{notification → services/providers/notification}/dtos/schedule-notification.dto.d.ts +0 -0
  363. /package/dist/modules/{pass → services/providers/pass}/dtos/create-guild-member-pass.dto.d.ts +0 -0
  364. /package/dist/modules/{pass → services/providers/pass}/dtos/create-team-member-pass.dto.d.ts +0 -0
  365. /package/dist/modules/{pass → services/providers/pass}/dtos/index.d.ts +0 -0
  366. /package/dist/modules/{pass → services/providers/pass}/dtos/index.js +0 -0
  367. /package/dist/modules/{search → services/providers/search}/dtos/index-search-document.dto.d.ts +0 -0
  368. /package/dist/modules/{search → services/providers/search}/dtos/index.d.ts +0 -0
  369. /package/dist/modules/{search → services/providers/search}/dtos/index.js +0 -0
  370. /package/dist/{modules/content → properties}/content.property.d.ts +0 -0
  371. /package/dist/{modules/content → properties}/content.property.js +0 -0
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskManager = void 0;
4
+ /**
5
+ * TaskManager is a utility class that collects asynchronous tasks
6
+ * and executes them in parallel.
7
+ *
8
+ * This is especially useful for orchestrating optional async operations
9
+ * where not all tasks need to be executed every time.
10
+ *
11
+ * Example:
12
+ * ```ts
13
+ * const taskManager = new TaskManager();
14
+ * taskManager.add(async () => { ... });
15
+ * taskManager.add(async () => { ... });
16
+ * await taskManager.run();
17
+ * ```
18
+ */
19
+ class TaskManager {
20
+ constructor() {
21
+ this.tasks = [];
22
+ }
23
+ /**
24
+ * Fetches all users for the given ID groups and returns a mapping.
25
+ * Ensures each user is fetched only once.
26
+ * @param userIdGroups Array of arrays of user IDs (e.g., authors, likedBy, viewedBy)
27
+ * @param accountsService Service responsible for fetching users
28
+ * @returns Map of userId -> user
29
+ */
30
+ static async fetchAndMapUsers(userIdGroups, accountsService) {
31
+ // Collect all unique user IDs across all groups
32
+ const uniqueUserIds = new Set(userIdGroups.flat());
33
+ // Fetch all users once
34
+ const userCollection = await accountsService.getUserCollection(Array.from(uniqueUserIds));
35
+ // Build a map for quick lookup
36
+ return new Map(userCollection.map((user) => [user.id, user]));
37
+ }
38
+ /**
39
+ * Fetches all users for the given ID groups and returns a mapping.
40
+ * Ensures each user is fetched only once.
41
+ * @param accountIdGroups Array of arrays of user IDs (e.g., authors, likedBy, viewedBy)
42
+ * @param accountsService Service responsible for fetching users
43
+ * @returns Map of userId -> user
44
+ */
45
+ static async fetchAndMapAccounts(accountIdGroups, accountsService) {
46
+ // Collect all unique user IDs across all groups
47
+ const uniqueAccountIds = new Set(accountIdGroups.flat());
48
+ // Fetch all users once
49
+ const accountCollection = await accountsService.getAccountCollection(Array.from(uniqueAccountIds));
50
+ // Build a map for quick lookup
51
+ return new Map(accountCollection.map((account) => [account.id, account]));
52
+ }
53
+ /**
54
+ * Maps an array of IDs to user objects using a userMap.
55
+ * Filters out any IDs that don’t have a corresponding user.
56
+ * @param userIds Array of user IDs to map
57
+ * @param userMap Map of userId -> user object
58
+ * @returns Array of user objects
59
+ */
60
+ static mapIdsToUsers(userIds, userMap) {
61
+ return userIds.map((userId) => userMap.get(userId)).filter(Boolean);
62
+ }
63
+ /**
64
+ * Maps an array of IDs to user objects using a userMap.
65
+ * Filters out any IDs that don’t have a corresponding user.
66
+ * @param accountIds Array of user IDs to map
67
+ * @param accountMap Map of userId -> user object
68
+ * @returns Array of user objects
69
+ */
70
+ static mapIdsToAccounts(accountIds, accountMap) {
71
+ return accountIds.map((accountId) => accountMap.get(accountId)).filter(Boolean);
72
+ }
73
+ /**
74
+ * Adds a new asynchronous task to the queue.
75
+ *
76
+ * @param task - A function that returns a Promise.
77
+ * It should contain the actual async logic to be executed.
78
+ */
79
+ add(task) {
80
+ this.tasks.push(task);
81
+ }
82
+ /**
83
+ * Executes all queued tasks in parallel and waits for their completion.
84
+ *
85
+ * - Tasks are executed concurrently using `Promise.all`.
86
+ * - If one task fails, the error will propagate and stop execution.
87
+ */
88
+ async run() {
89
+ await Promise.all(this.tasks.map((task) => task()));
90
+ }
91
+ /**
92
+ * Clears all tasks from the queue without executing them.
93
+ * Useful if you want to reset and reuse the TaskManager instance.
94
+ */
95
+ clear() {
96
+ this.tasks = [];
97
+ }
98
+ }
99
+ exports.TaskManager = TaskManager;
@@ -1,4 +1,4 @@
1
- import { AccountEntity } from '../models';
1
+ import { Account } from '../models';
2
2
  /**
3
3
  * Custom parameter decorator to extract the authenticated user's account
4
4
  * or a specific attribute from it within route handlers.
@@ -10,8 +10,8 @@ import { AccountEntity } from '../models';
10
10
  * If no user account is found on the request, it throws an UnprocessableEntityException,
11
11
  * signaling that the request is missing necessary authentication context.
12
12
  *
13
- * @param {keyof AccountEntity} [attribute] - Optional key of the AccountEntity to extract.
13
+ * @param {keyof Account} [attribute] - Optional key of the Account to extract.
14
14
  * @param {ExecutionContext} executionContext - The context of the current request.
15
- * @returns {AccountEntity[keyof AccountEntity] | AccountEntity} The requested account attribute or full account object.
15
+ * @returns {Account[keyof Account] | Account} The requested account attribute or full account object.
16
16
  */
17
- export declare const Account: (...dataOrPipes: (keyof AccountEntity | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
17
+ export declare const AuthenticatedAccount: (...dataOrPipes: (keyof Account | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Account = void 0;
3
+ exports.AuthenticatedAccount = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
+ const exceptions_1 = require("../exceptions");
5
6
  /**
6
7
  * Custom parameter decorator to extract the authenticated user's account
7
8
  * or a specific attribute from it within route handlers.
@@ -13,16 +14,13 @@ const common_1 = require("@nestjs/common");
13
14
  * If no user account is found on the request, it throws an UnprocessableEntityException,
14
15
  * signaling that the request is missing necessary authentication context.
15
16
  *
16
- * @param {keyof AccountEntity} [attribute] - Optional key of the AccountEntity to extract.
17
+ * @param {keyof Account} [attribute] - Optional key of the Account to extract.
17
18
  * @param {ExecutionContext} executionContext - The context of the current request.
18
- * @returns {AccountEntity[keyof AccountEntity] | AccountEntity} The requested account attribute or full account object.
19
+ * @returns {Account[keyof Account] | Account} The requested account attribute or full account object.
19
20
  */
20
- exports.Account = (0, common_1.createParamDecorator)((attribute, executionContext) => {
21
+ exports.AuthenticatedAccount = (0, common_1.createParamDecorator)((attribute, executionContext) => {
21
22
  const request = executionContext.switchToHttp().getRequest();
22
- const userAccount = request.user;
23
- if (!userAccount) {
24
- throw new common_1.UnprocessableEntityException('Authenticated user context is missing in the request.');
25
- }
26
- // Return the requested attribute if specified; otherwise, return the entire account object.
27
- return attribute ? userAccount[attribute] : userAccount;
23
+ if (!request.account)
24
+ throw new exceptions_1.AuthenticatedAccountRequiredException();
25
+ return attribute ? request.account[attribute] : request.account;
28
26
  });
@@ -1,2 +1,2 @@
1
- export * from './account.decorator';
1
+ export * from './authenticated-account.decorator';
2
2
  export * from './jwt.decorator';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./account.decorator"), exports);
17
+ __exportStar(require("./authenticated-account.decorator"), exports);
18
18
  __exportStar(require("./jwt.decorator"), exports);
@@ -0,0 +1,34 @@
1
+ import { ForbiddenException } from '@nestjs/common';
2
+ /**
3
+ * AuthenticatedAccountRequiredException
4
+ *
5
+ * Custom exception extending NestJS's `ForbiddenException`.
6
+ * This should be thrown when a request is made to an endpoint that
7
+ * explicitly requires a Bearer Token for authentication.
8
+ *
9
+ * By centralizing the exception here, we ensure consistent error
10
+ * messaging and simplify future changes (e.g., localization or
11
+ * error structure updates).
12
+ */
13
+ export declare class AuthenticatedAccountRequiredException extends ForbiddenException {
14
+ /**
15
+ * Creates a new `AuthenticatedAccountRequiredException`.
16
+ *
17
+ * @param {string} [message] - Optional custom error message.
18
+ * Defaults to a standard message if none is provided.
19
+ */
20
+ constructor(message?: string);
21
+ }
22
+ /**
23
+ * ApiAuthenticatedAccountRequiredResponse
24
+ *
25
+ * Swagger documentation decorator for endpoints that return a `403 Forbidden`
26
+ * when accessed without authentication. Applying this makes the generated
27
+ * API docs clear about the requirement for a Bearer Token and communicates
28
+ * the error condition to consumers.
29
+ *
30
+ * @param {string} [description] - Optional custom description for the response.
31
+ * Defaults to the standard authentication error message.
32
+ * @returns {MethodDecorator} - Swagger decorator marking a 403 forbidden response.
33
+ */
34
+ export declare function ApiAuthenticatedAccountRequiredResponse(description?: string): MethodDecorator;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthenticatedAccountRequiredException = void 0;
4
+ exports.ApiAuthenticatedAccountRequiredResponse = ApiAuthenticatedAccountRequiredResponse;
5
+ const common_1 = require("@nestjs/common");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ /**
8
+ * Default error message used when an endpoint is accessed without authentication.
9
+ * This provides a consistent and descriptive response to unauthorized users.
10
+ */
11
+ const defaultAuthenticatedAccountRequiredErrorMessage = 'Authenticated user context is missing in the request.';
12
+ /**
13
+ * AuthenticatedAccountRequiredException
14
+ *
15
+ * Custom exception extending NestJS's `ForbiddenException`.
16
+ * This should be thrown when a request is made to an endpoint that
17
+ * explicitly requires a Bearer Token for authentication.
18
+ *
19
+ * By centralizing the exception here, we ensure consistent error
20
+ * messaging and simplify future changes (e.g., localization or
21
+ * error structure updates).
22
+ */
23
+ class AuthenticatedAccountRequiredException extends common_1.ForbiddenException {
24
+ /**
25
+ * Creates a new `AuthenticatedAccountRequiredException`.
26
+ *
27
+ * @param {string} [message] - Optional custom error message.
28
+ * Defaults to a standard message if none is provided.
29
+ */
30
+ constructor(message) {
31
+ super(message || defaultAuthenticatedAccountRequiredErrorMessage);
32
+ }
33
+ }
34
+ exports.AuthenticatedAccountRequiredException = AuthenticatedAccountRequiredException;
35
+ /**
36
+ * ApiAuthenticatedAccountRequiredResponse
37
+ *
38
+ * Swagger documentation decorator for endpoints that return a `403 Forbidden`
39
+ * when accessed without authentication. Applying this makes the generated
40
+ * API docs clear about the requirement for a Bearer Token and communicates
41
+ * the error condition to consumers.
42
+ *
43
+ * @param {string} [description] - Optional custom description for the response.
44
+ * Defaults to the standard authentication error message.
45
+ * @returns {MethodDecorator} - Swagger decorator marking a 403 forbidden response.
46
+ */
47
+ function ApiAuthenticatedAccountRequiredResponse(description) {
48
+ return (0, swagger_1.ApiForbiddenResponse)({
49
+ description: description || defaultAuthenticatedAccountRequiredErrorMessage,
50
+ });
51
+ }
@@ -2,26 +2,37 @@ import { UnprocessableEntityException } from '@nestjs/common';
2
2
  /**
3
3
  * BadBodyException
4
4
  *
5
- * Thrown when an incoming request body is invalid or malformed.
6
- * Typical use cases include missing required fields, incorrect data types,
7
- * or values that violate schema or business validation rules.
5
+ * Custom exception extending NestJS's `UnprocessableEntityException`.
6
+ * This exception should be thrown when the request body fails validation
7
+ * or cannot be interpreted correctly by the server.
8
8
  *
9
- * Returns a standardized HTTP 422 Unprocessable Entity error.
9
+ * Typical scenarios include:
10
+ * - Missing required fields
11
+ * - Incorrect or unexpected data types
12
+ * - Values violating schema constraints or business rules
13
+ *
14
+ * By encapsulating this exception, we provide a clear and consistent
15
+ * mechanism for handling client input errors across the application.
10
16
  */
11
17
  export declare class BadBodyException extends UnprocessableEntityException {
12
18
  /**
13
- * Creates a new BadBodyException with an optional custom message.
19
+ * Constructs a new `BadBodyException`.
14
20
  *
15
- * @param {string} [message] - Optional error message describing the specific validation issue.
21
+ * @param {string} [message] - Optional custom error message for additional context.
22
+ * Defaults to a standardized message if not provided.
16
23
  */
17
24
  constructor(message?: string);
18
25
  }
19
26
  /**
20
27
  * ApiBadBodyResponse
21
28
  *
22
- * Swagger decorator for documenting 422 Unprocessable Entity responses due to invalid request bodies.
29
+ * Swagger documentation decorator for `422 Unprocessable Entity` responses.
30
+ * Apply this to routes that may reject invalid or malformed request bodies.
31
+ * This ensures the generated API documentation communicates the validation
32
+ * expectations and error conditions to API consumers.
23
33
  *
24
34
  * @param {string} [description] - Optional custom description for the response.
25
- * @returns {MethodDecorator} Swagger method decorator.
35
+ * Defaults to a standardized message if not provided.
36
+ * @returns {MethodDecorator} - Swagger method decorator marking the response.
26
37
  */
27
38
  export declare function ApiBadBodyResponse(description?: string): MethodDecorator;
@@ -4,36 +4,52 @@ exports.BadBodyException = void 0;
4
4
  exports.ApiBadBodyResponse = ApiBadBodyResponse;
5
5
  const common_1 = require("@nestjs/common");
6
6
  const swagger_1 = require("@nestjs/swagger");
7
+ /**
8
+ * Default error message returned when the request body cannot be processed.
9
+ * This ensures consistency across thrown exceptions and documented responses.
10
+ */
11
+ const defaultBadBodyErrorMessage = 'The request body is invalid or malformed.';
7
12
  /**
8
13
  * BadBodyException
9
14
  *
10
- * Thrown when an incoming request body is invalid or malformed.
11
- * Typical use cases include missing required fields, incorrect data types,
12
- * or values that violate schema or business validation rules.
15
+ * Custom exception extending NestJS's `UnprocessableEntityException`.
16
+ * This exception should be thrown when the request body fails validation
17
+ * or cannot be interpreted correctly by the server.
18
+ *
19
+ * Typical scenarios include:
20
+ * - Missing required fields
21
+ * - Incorrect or unexpected data types
22
+ * - Values violating schema constraints or business rules
13
23
  *
14
- * Returns a standardized HTTP 422 Unprocessable Entity error.
24
+ * By encapsulating this exception, we provide a clear and consistent
25
+ * mechanism for handling client input errors across the application.
15
26
  */
16
27
  class BadBodyException extends common_1.UnprocessableEntityException {
17
28
  /**
18
- * Creates a new BadBodyException with an optional custom message.
29
+ * Constructs a new `BadBodyException`.
19
30
  *
20
- * @param {string} [message] - Optional error message describing the specific validation issue.
31
+ * @param {string} [message] - Optional custom error message for additional context.
32
+ * Defaults to a standardized message if not provided.
21
33
  */
22
34
  constructor(message) {
23
- super(message || 'The request body is invalid or malformed.');
35
+ super(message || defaultBadBodyErrorMessage);
24
36
  }
25
37
  }
26
38
  exports.BadBodyException = BadBodyException;
27
39
  /**
28
40
  * ApiBadBodyResponse
29
41
  *
30
- * Swagger decorator for documenting 422 Unprocessable Entity responses due to invalid request bodies.
42
+ * Swagger documentation decorator for `422 Unprocessable Entity` responses.
43
+ * Apply this to routes that may reject invalid or malformed request bodies.
44
+ * This ensures the generated API documentation communicates the validation
45
+ * expectations and error conditions to API consumers.
31
46
  *
32
47
  * @param {string} [description] - Optional custom description for the response.
33
- * @returns {MethodDecorator} Swagger method decorator.
48
+ * Defaults to a standardized message if not provided.
49
+ * @returns {MethodDecorator} - Swagger method decorator marking the response.
34
50
  */
35
51
  function ApiBadBodyResponse(description) {
36
52
  return (0, swagger_1.ApiUnprocessableEntityResponse)({
37
- description: description || 'The request body is invalid or malformed.',
53
+ description: description || defaultBadBodyErrorMessage,
38
54
  });
39
55
  }
@@ -2,25 +2,40 @@ import { BadRequestException } from '@nestjs/common';
2
2
  /**
3
3
  * BadParameterException
4
4
  *
5
- * Thrown when one or more parameters (query, route, or body) are invalid.
6
- * Useful for early input validation or handling malformed inputs.
5
+ * Custom exception extending NestJS's `BadRequestException`.
6
+ * This exception is thrown when one or more request parameters (query,
7
+ * route, or body) are invalid or malformed.
7
8
  *
8
- * Returns a standardized HTTP 400 Bad Request error.
9
+ * Common scenarios:
10
+ * - Query string contains unexpected or invalid values
11
+ * - Route parameters fail validation
12
+ * - Request body includes fields that do not conform to expected types
13
+ *
14
+ * By encapsulating this exception, we standardize error responses for
15
+ * invalid parameters and provide consistent error messaging across the API.
9
16
  */
10
17
  export declare class BadParameterException extends BadRequestException {
11
18
  /**
12
- * Constructs a BadParameterException with optional parameter name.
19
+ * Constructs a new `BadParameterException`.
13
20
  *
14
- * @param {string} [parameter] - Name of the invalid parameter (optional).
21
+ * @param {string} [parameter] - Optional name of the invalid parameter.
22
+ * If provided, the message will reference that parameter directly.
15
23
  */
16
24
  constructor(parameter?: string);
17
25
  }
18
26
  /**
19
27
  * ApiBadParameterResponse
20
28
  *
21
- * Swagger decorator for documenting 400 Bad Request responses due to parameter issues.
29
+ * Swagger documentation decorator for `400 Bad Request` responses caused
30
+ * by invalid request parameters. This makes it explicit in API docs that
31
+ * certain routes may reject requests with malformed or unsupported input.
32
+ *
33
+ * The decorator dynamically adjusts the description based on the provided
34
+ * parameter names, making documentation precise and self-explanatory.
22
35
  *
23
- * @param {string[]} params - One or more invalid parameters to include in the description.
24
- * @returns {MethodDecorator} Swagger method decorator.
36
+ * @param {...string} params - One or more invalid parameter names to
37
+ * include in the response description. If none are provided, a generic
38
+ * description is used instead.
39
+ * @returns {MethodDecorator} - Swagger method decorator for a 400 response.
25
40
  */
26
41
  export declare function ApiBadParameterResponse(...params: string[]): MethodDecorator;
@@ -8,38 +8,61 @@ const itlab_functions_1 = require("itlab-functions");
8
8
  /**
9
9
  * BadParameterException
10
10
  *
11
- * Thrown when one or more parameters (query, route, or body) are invalid.
12
- * Useful for early input validation or handling malformed inputs.
11
+ * Custom exception extending NestJS's `BadRequestException`.
12
+ * This exception is thrown when one or more request parameters (query,
13
+ * route, or body) are invalid or malformed.
13
14
  *
14
- * Returns a standardized HTTP 400 Bad Request error.
15
+ * Common scenarios:
16
+ * - Query string contains unexpected or invalid values
17
+ * - Route parameters fail validation
18
+ * - Request body includes fields that do not conform to expected types
19
+ *
20
+ * By encapsulating this exception, we standardize error responses for
21
+ * invalid parameters and provide consistent error messaging across the API.
15
22
  */
16
23
  class BadParameterException extends common_1.BadRequestException {
17
24
  /**
18
- * Constructs a BadParameterException with optional parameter name.
25
+ * Constructs a new `BadParameterException`.
19
26
  *
20
- * @param {string} [parameter] - Name of the invalid parameter (optional).
27
+ * @param {string} [parameter] - Optional name of the invalid parameter.
28
+ * If provided, the message will reference that parameter directly.
21
29
  */
22
30
  constructor(parameter) {
23
- super(parameter ? `Invalid parameter: ${parameter}` : 'One or more parameters are invalid.');
31
+ super(parameter ? `Invalid parameter: ${parameter}` : 'One or more request parameters are invalid.');
24
32
  }
25
33
  }
26
34
  exports.BadParameterException = BadParameterException;
27
35
  /**
28
36
  * ApiBadParameterResponse
29
37
  *
30
- * Swagger decorator for documenting 400 Bad Request responses due to parameter issues.
38
+ * Swagger documentation decorator for `400 Bad Request` responses caused
39
+ * by invalid request parameters. This makes it explicit in API docs that
40
+ * certain routes may reject requests with malformed or unsupported input.
41
+ *
42
+ * The decorator dynamically adjusts the description based on the provided
43
+ * parameter names, making documentation precise and self-explanatory.
31
44
  *
32
- * @param {string[]} params - One or more invalid parameters to include in the description.
33
- * @returns {MethodDecorator} Swagger method decorator.
45
+ * @param {...string} params - One or more invalid parameter names to
46
+ * include in the response description. If none are provided, a generic
47
+ * description is used instead.
48
+ * @returns {MethodDecorator} - Swagger method decorator for a 400 response.
34
49
  */
35
50
  function ApiBadParameterResponse(...params) {
36
- let description = 'Invalid parameter';
37
- if (params.length > 0) {
38
- description += params.length > 1 ? 's' : '';
39
- description += `: ${(0, itlab_functions_1.formatList)(params)}`;
40
- }
41
- else {
42
- description = 'One or more parameters are invalid.';
43
- }
44
- return (0, swagger_1.ApiBadRequestResponse)({ description });
51
+ const decorator = (target, propertyKey, descriptor) => {
52
+ var _a, _b;
53
+ // Extract existing Swagger metadata for this method (if any).
54
+ const existingResponses = Reflect.getMetadata('swagger/apiResponse', (descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) || target) || {};
55
+ // Collect any already-registered bad request description.
56
+ const existingDescription = (_b = (_a = existingResponses === null || existingResponses === void 0 ? void 0 : existingResponses[400]) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : '';
57
+ // Format description with proper pluralization.
58
+ const pluralized = params.length > 1 ? 's' : '';
59
+ const newDescription = params.length
60
+ ? `Invalid parameter${pluralized}: ${(0, itlab_functions_1.formatList)(params, 'or')}`
61
+ : 'One or more request parameters are invalid.';
62
+ // Merge with existing description if needed.
63
+ const mergedDescription = existingDescription ? `${existingDescription}<br />${newDescription}` : newDescription;
64
+ // Apply merged Swagger metadata.
65
+ (0, swagger_1.ApiBadRequestResponse)({ description: mergedDescription })(target, propertyKey, descriptor);
66
+ };
67
+ return decorator;
45
68
  }
@@ -2,25 +2,37 @@ import { ConflictException } from '@nestjs/common';
2
2
  /**
3
3
  * DuplicateException
4
4
  *
5
- * Thrown when an attempt is made to create or register an entity that already exists.
6
- * Common use cases include duplicate usernames, emails, or unique constraints.
5
+ * Custom exception extending NestJS's `ConflictException`.
6
+ * This should be thrown when an operation attempts to create or register
7
+ * an entity that violates a uniqueness constraint or already exists in the system.
7
8
  *
8
- * Returns a standardized HTTP 409 Conflict response.
9
+ * Typical scenarios include:
10
+ * - Attempting to register a username or email already in use
11
+ * - Inserting database records that violate unique constraints
12
+ * - Uploading or creating resources with duplicate identifiers
13
+ *
14
+ * Returning a standardized `409 Conflict` response helps API consumers
15
+ * distinguish duplication errors from other kinds of client-side mistakes.
9
16
  */
10
17
  export declare class DuplicateException extends ConflictException {
11
18
  /**
12
- * Constructs a DuplicateException with optional custom message.
19
+ * Creates a new `DuplicateException`.
13
20
  *
14
- * @param {string} [message] - Optional message explaining what entity is duplicated.
21
+ * @param {string} [message] - Optional custom error message describing
22
+ * the specific duplication issue. Defaults to a standardized message if omitted.
15
23
  */
16
24
  constructor(message?: string);
17
25
  }
18
26
  /**
19
27
  * ApiDuplicateResponse
20
28
  *
21
- * Swagger decorator for documenting 409 Conflict responses caused by duplicate entities.
29
+ * Swagger documentation decorator for `409 Conflict` responses caused
30
+ * by duplicate resource creation attempts. Applying this decorator
31
+ * ensures that the generated API docs communicate uniqueness constraints
32
+ * and possible error conditions clearly to consumers.
22
33
  *
23
- * @param {string} [description] - Optional description for the conflict error.
24
- * @returns {MethodDecorator} Swagger method decorator.
34
+ * @param {string} [description] - Optional custom description of the duplication error.
35
+ * Defaults to a standardized message if omitted.
36
+ * @returns {MethodDecorator} - Swagger method decorator for documenting conflict responses.
25
37
  */
26
38
  export declare function ApiDuplicateResponse(description?: string): MethodDecorator;
@@ -4,35 +4,52 @@ exports.DuplicateException = void 0;
4
4
  exports.ApiDuplicateResponse = ApiDuplicateResponse;
5
5
  const common_1 = require("@nestjs/common");
6
6
  const swagger_1 = require("@nestjs/swagger");
7
+ /**
8
+ * Default error message used when a duplicate resource is encountered.
9
+ * This ensures consistent error responses and simplifies reuse across the app.
10
+ */
11
+ const defaultDuplicateResourceMessage = 'A resource with the same value already exists.';
7
12
  /**
8
13
  * DuplicateException
9
14
  *
10
- * Thrown when an attempt is made to create or register an entity that already exists.
11
- * Common use cases include duplicate usernames, emails, or unique constraints.
15
+ * Custom exception extending NestJS's `ConflictException`.
16
+ * This should be thrown when an operation attempts to create or register
17
+ * an entity that violates a uniqueness constraint or already exists in the system.
18
+ *
19
+ * Typical scenarios include:
20
+ * - Attempting to register a username or email already in use
21
+ * - Inserting database records that violate unique constraints
22
+ * - Uploading or creating resources with duplicate identifiers
12
23
  *
13
- * Returns a standardized HTTP 409 Conflict response.
24
+ * Returning a standardized `409 Conflict` response helps API consumers
25
+ * distinguish duplication errors from other kinds of client-side mistakes.
14
26
  */
15
27
  class DuplicateException extends common_1.ConflictException {
16
28
  /**
17
- * Constructs a DuplicateException with optional custom message.
29
+ * Creates a new `DuplicateException`.
18
30
  *
19
- * @param {string} [message] - Optional message explaining what entity is duplicated.
31
+ * @param {string} [message] - Optional custom error message describing
32
+ * the specific duplication issue. Defaults to a standardized message if omitted.
20
33
  */
21
34
  constructor(message) {
22
- super(message || 'A record with the same value already exists.');
35
+ super(message || defaultDuplicateResourceMessage);
23
36
  }
24
37
  }
25
38
  exports.DuplicateException = DuplicateException;
26
39
  /**
27
40
  * ApiDuplicateResponse
28
41
  *
29
- * Swagger decorator for documenting 409 Conflict responses caused by duplicate entities.
42
+ * Swagger documentation decorator for `409 Conflict` responses caused
43
+ * by duplicate resource creation attempts. Applying this decorator
44
+ * ensures that the generated API docs communicate uniqueness constraints
45
+ * and possible error conditions clearly to consumers.
30
46
  *
31
- * @param {string} [description] - Optional description for the conflict error.
32
- * @returns {MethodDecorator} Swagger method decorator.
47
+ * @param {string} [description] - Optional custom description of the duplication error.
48
+ * Defaults to a standardized message if omitted.
49
+ * @returns {MethodDecorator} - Swagger method decorator for documenting conflict responses.
33
50
  */
34
51
  function ApiDuplicateResponse(description) {
35
52
  return (0, swagger_1.ApiConflictResponse)({
36
- description: description || 'A record with the same value already exists.',
53
+ description: description || defaultDuplicateResourceMessage,
37
54
  });
38
55
  }
@@ -1,3 +1,4 @@
1
+ export * from './authenticated-user-required.exception';
1
2
  export * from './bad-body.exception';
2
3
  export * from './bad-parameter.exception';
3
4
  export * from './duplicate.exception';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./authenticated-user-required.exception"), exports);
17
18
  __exportStar(require("./bad-body.exception"), exports);
18
19
  __exportStar(require("./bad-parameter.exception"), exports);
19
20
  __exportStar(require("./duplicate.exception"), exports);
@@ -0,0 +1,15 @@
1
+ import { Document, Schema } from 'mongoose';
2
+ /**
3
+ * Enhances a Mongoose schema by adding virtual fields for computed values.
4
+ *
5
+ * This function inspects the schema's definition for special tracking arrays
6
+ * (such as `_viewedBy` or `_likedBy`). If those arrays exist, it adds
7
+ * corresponding virtual properties (`views` and `likes`) to the schema.
8
+ * These virtuals provide a clean way to access the number of views or likes
9
+ * without needing to calculate them manually each time.
10
+ *
11
+ * @template T - A type extending the Mongoose Document interface.
12
+ * @param {Schema<T>} schema - The Mongoose schema to augment with virtuals.
13
+ * @returns {void} - Modifies the schema in place; no return value.
14
+ */
15
+ export declare function addViewsLikesVirtuals<T extends Document>(schema: Schema<T>): void;