@kipicore/dbcore 1.1.694 → 1.1.696

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 (310) hide show
  1. package/dist/commonValidator/commandValidator.d.ts +27 -0
  2. package/dist/commonValidator/commandValidator.js +225 -0
  3. package/dist/commonValidator/index.d.ts +3 -0
  4. package/dist/commonValidator/index.js +24 -0
  5. package/dist/commonValidator/joiCommonValidator.d.ts +12 -0
  6. package/dist/commonValidator/joiCommonValidator.js +47 -0
  7. package/dist/commonValidator/joiSchemaBuilder.d.ts +6 -0
  8. package/dist/commonValidator/joiSchemaBuilder.js +70 -0
  9. package/dist/configs/env.d.ts +2 -0
  10. package/dist/configs/env.js +4 -0
  11. package/dist/configs/index.d.ts +2 -0
  12. package/dist/configs/index.js +2 -0
  13. package/dist/configs/logger.d.ts +2 -0
  14. package/dist/configs/logger.js +44 -0
  15. package/dist/configs/redisConfig.d.ts +4 -0
  16. package/dist/configs/redisConfig.js +32 -0
  17. package/dist/constants/app.d.ts +30 -58
  18. package/dist/constants/app.js +37 -70
  19. package/dist/constants/defaultModelAttributes.js +2 -1
  20. package/dist/constants/errorMessages.d.ts +20 -1
  21. package/dist/constants/errorMessages.js +22 -1
  22. package/dist/constants/successMessages.d.ts +14 -0
  23. package/dist/constants/successMessages.js +17 -1
  24. package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +46 -0
  25. package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +20 -0
  26. package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +156 -0
  27. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +2 -0
  28. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +19 -0
  29. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +2 -0
  30. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +19 -0
  31. package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +2 -0
  32. package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +19 -0
  33. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.d.ts +2 -0
  34. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js +12 -0
  35. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +2 -0
  36. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +42 -0
  37. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.d.ts +2 -0
  38. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.js +22 -0
  39. package/dist/db/psql/migrations/20260727123149-add_vendorCompanyId_to_institute_ownership_histories.js +23 -0
  40. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.d.ts +2 -0
  41. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.js +23 -0
  42. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.d.ts +2 -0
  43. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.js +28 -0
  44. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.d.ts +2 -0
  45. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.js +25 -0
  46. package/dist/db/psql/migrations/20260729055118-institutePartners.d.ts +2 -0
  47. package/dist/db/psql/migrations/20260729055118-institutePartners.js +28 -0
  48. package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.d.ts +2 -0
  49. package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.js +25 -0
  50. package/dist/helpers/index.d.ts +3 -0
  51. package/dist/helpers/index.js +3 -0
  52. package/dist/helpers/sendEmail.d.ts +3 -0
  53. package/dist/helpers/sendEmail.js +117 -0
  54. package/dist/helpers/sendNotification.d.ts +4 -0
  55. package/dist/helpers/sendNotification.js +34 -0
  56. package/dist/helpers/sendSMS.d.ts +5 -0
  57. package/dist/helpers/sendSMS.js +34 -0
  58. package/dist/helpers/utils.d.ts +5 -3
  59. package/dist/helpers/utils.js +58 -31
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +4 -0
  62. package/dist/interfaces/aiModelKeysInterface.d.ts +15 -0
  63. package/dist/interfaces/categoriesInterface.d.ts +2 -1
  64. package/dist/interfaces/index.d.ts +1 -18
  65. package/dist/interfaces/index.js +1 -19
  66. package/dist/interfaces/instituteInterface.d.ts +1 -0
  67. package/dist/interfaces/instituteOwnershipHistoryInterface.d.ts +2 -1
  68. package/dist/interfaces/institutePartnersInterface.d.ts +2 -1
  69. package/dist/interfaces/photosGalleryInterface.d.ts +1 -3
  70. package/dist/interfaces/sendNotificationInerface.d.ts +0 -2
  71. package/dist/interfaces/subCategoriesInterface.d.ts +2 -1
  72. package/dist/interfaces/subscriptionPlanInterface.d.ts +2 -1
  73. package/dist/interfaces/testimonialInterface.d.ts +0 -1
  74. package/dist/interfaces/userInstituteMetaInterface.d.ts +1 -1
  75. package/dist/interfaces/userInterface.d.ts +3 -1
  76. package/dist/interfaces/vendorCompanyMetaInterface.d.ts +5 -2
  77. package/dist/models/mongodb/additionalDetailsModel.js +1 -1
  78. package/dist/models/mongodb/advertisementModel.js +1 -1
  79. package/dist/models/mongodb/appAnalyticsEventModel.js +1 -1
  80. package/dist/models/mongodb/appointmentHistoryModel.js +1 -1
  81. package/dist/models/mongodb/appointmentModel.js +1 -1
  82. package/dist/models/mongodb/approvalRequestModel.js +1 -1
  83. package/dist/models/mongodb/assignFileModel.js +1 -1
  84. package/dist/models/mongodb/attendanceModel.js +1 -1
  85. package/dist/models/mongodb/bDayWishModel.js +1 -1
  86. package/dist/models/mongodb/blogModel.js +1 -1
  87. package/dist/models/mongodb/campusCarnivalModel.js +1 -1
  88. package/dist/models/mongodb/canteenModel.js +1 -1
  89. package/dist/models/mongodb/careerModel.js +1 -1
  90. package/dist/models/mongodb/certificatesHistoryModel.js +1 -1
  91. package/dist/models/mongodb/certificatesManagementModel.js +1 -1
  92. package/dist/models/mongodb/columnModel.js +1 -1
  93. package/dist/models/mongodb/communityGroupMemberModel.js +1 -1
  94. package/dist/models/mongodb/communityGroupModel.js +1 -1
  95. package/dist/models/mongodb/communityMessageModel.js +1 -1
  96. package/dist/models/mongodb/competitionGroupModel.js +1 -1
  97. package/dist/models/mongodb/competitionModel.js +1 -1
  98. package/dist/models/mongodb/competitionUsersModel.js +1 -1
  99. package/dist/models/mongodb/createPollModel.js +1 -1
  100. package/dist/models/mongodb/dailyBookModel.js +1 -1
  101. package/dist/models/mongodb/dashboardManagementModel.js +1 -1
  102. package/dist/models/mongodb/educationOfficerModel.js +1 -1
  103. package/dist/models/mongodb/eventModel.js +1 -1
  104. package/dist/models/mongodb/eventTemplatesModel.js +1 -1
  105. package/dist/models/mongodb/examGroupModel.js +1 -1
  106. package/dist/models/mongodb/examHasAnswerSheetModel.js +1 -1
  107. package/dist/models/mongodb/examModel.js +1 -1
  108. package/dist/models/mongodb/feeConfigModel.js +1 -1
  109. package/dist/models/mongodb/feeReminderTypeModel.js +1 -1
  110. package/dist/models/mongodb/feeSubmissionModel.js +1 -1
  111. package/dist/models/mongodb/feedBackModel.js +1 -1
  112. package/dist/models/mongodb/fileUploadUserDetailsModel.js +1 -1
  113. package/dist/models/mongodb/finalMarkSheetModel.js +1 -1
  114. package/dist/models/mongodb/generateIdCardModel.js +1 -1
  115. package/dist/models/mongodb/grantAndDonationModel.js +1 -1
  116. package/dist/models/mongodb/holidayModel.js +1 -1
  117. package/dist/models/mongodb/index.d.ts +0 -7
  118. package/dist/models/mongodb/index.js +1 -16
  119. package/dist/models/mongodb/informationSupportModel.js +1 -1
  120. package/dist/models/mongodb/inquiryModel.js +1 -1
  121. package/dist/models/mongodb/instituteFeeModel.js +1 -1
  122. package/dist/models/mongodb/invoiceModel.js +1 -1
  123. package/dist/models/mongodb/jobApplyModel.js +1 -1
  124. package/dist/models/mongodb/kipiverseContactFormModel.js +1 -1
  125. package/dist/models/mongodb/markSheetConfigurationModel.js +1 -1
  126. package/dist/models/mongodb/modulePriceModel.js +1 -1
  127. package/dist/models/mongodb/offerAndDiscountModel.js +1 -1
  128. package/dist/models/mongodb/onlineLectureModel.js +1 -1
  129. package/dist/models/mongodb/pastYearRecordTopperModel.js +1 -1
  130. package/dist/models/mongodb/pdcChequeConfigurationModel.js +1 -1
  131. package/dist/models/mongodb/photosGalleryModel.js +2 -6
  132. package/dist/models/mongodb/plannerModel.js +1 -1
  133. package/dist/models/mongodb/pollSelectionModel.js +1 -1
  134. package/dist/models/mongodb/productMetaModel.js +10 -2
  135. package/dist/models/mongodb/replaceTeacherModel.js +1 -1
  136. package/dist/models/mongodb/rmsAmcContractModel.js +1 -1
  137. package/dist/models/mongodb/rmsAuditLogModel.js +1 -1
  138. package/dist/models/mongodb/rmsDigitalResourceAccessModel.js +1 -1
  139. package/dist/models/mongodb/rmsDigitalResourceModel.js +1 -1
  140. package/dist/models/mongodb/rmsResourceDetailsModel.d.ts +1 -7
  141. package/dist/models/mongodb/rmsResourceDetailsModel.js +1 -1
  142. package/dist/models/mongodb/roleHasPermissionModel.js +1 -1
  143. package/dist/models/mongodb/schoolFee1Model.js +1 -1
  144. package/dist/models/mongodb/seatingArrangementModel.js +1 -1
  145. package/dist/models/mongodb/sheetFieldModel.js +1 -1
  146. package/dist/models/mongodb/subjectIndexModel.js +1 -1
  147. package/dist/models/mongodb/subscriptionConfigurationModel.js +1 -1
  148. package/dist/models/mongodb/subscriptionPlanModel.js +6 -1
  149. package/dist/models/mongodb/taskManagementModel.js +1 -1
  150. package/dist/models/mongodb/themeModel.js +1 -1
  151. package/dist/models/mongodb/ticketRaiseModel.js +1 -1
  152. package/dist/models/mongodb/uniqueNumberCounterModel.js +1 -1
  153. package/dist/models/mongodb/userDetailsModel.js +1 -1
  154. package/dist/models/mongodb/userFinalResultModel.js +1 -1
  155. package/dist/models/mongodb/userInstituteMetaModel.js +1 -5
  156. package/dist/models/mongodb/userSchoolMetaModel.d.ts +1 -6
  157. package/dist/models/mongodb/userSchoolMetaModel.js +36 -3
  158. package/dist/models/mongodb/vendorCompanyMetaModel.js +16 -2
  159. package/dist/models/mongodb/videoAnalystModel.js +1 -1
  160. package/dist/models/mongodb/walletTransactionModel.js +1 -1
  161. package/dist/models/psql/SubCategoriesModel.d.ts +2 -1
  162. package/dist/models/psql/SubCategoriesModel.js +5 -0
  163. package/dist/models/psql/aiModelKeysModel.d.ts +20 -0
  164. package/dist/models/psql/aiModelKeysModel.js +70 -0
  165. package/dist/models/psql/categoriesModel.d.ts +2 -1
  166. package/dist/models/psql/categoriesModel.js +5 -0
  167. package/dist/models/psql/fileStorageModel.js +3 -4
  168. package/dist/models/psql/index.d.ts +1 -11
  169. package/dist/models/psql/index.js +4 -25
  170. package/dist/models/psql/instituteModel.d.ts +1 -0
  171. package/dist/models/psql/instituteModel.js +5 -2
  172. package/dist/models/psql/instituteOwnershipHistoryModel.d.ts +2 -1
  173. package/dist/models/psql/instituteOwnershipHistoryModel.js +8 -3
  174. package/dist/models/psql/institutePartnersModel.d.ts +2 -1
  175. package/dist/models/psql/institutePartnersModel.js +8 -3
  176. package/dist/models/psql/sendNotificationModel.d.ts +0 -1
  177. package/dist/models/psql/sendNotificationModel.js +0 -5
  178. package/dist/models/psql/testimonialModel.d.ts +0 -1
  179. package/dist/models/psql/testimonialModel.js +7 -8
  180. package/dist/models/psql/userModel.d.ts +3 -1
  181. package/dist/models/psql/userModel.js +2 -2
  182. package/dist/queues/emailQueue.d.ts +3 -0
  183. package/dist/queues/emailQueue.js +22 -0
  184. package/dist/queues/emailWorker.d.ts +3 -0
  185. package/dist/queues/emailWorker.js +33 -0
  186. package/dist/queues/index.d.ts +2 -0
  187. package/dist/queues/index.js +18 -0
  188. package/dist/types/aiModelKeysType.d.ts +3 -0
  189. package/dist/types/commonType.d.ts +29 -1
  190. package/dist/types/index.d.ts +1 -18
  191. package/dist/types/index.js +1 -19
  192. package/package.json +10 -2
  193. package/dist/db/psql/migrations/20260714095754-create-arena-models.js +0 -642
  194. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +0 -2
  195. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +0 -138
  196. package/dist/db/psql/migrations/20260722143500-create-school_has_sports.js +0 -71
  197. package/dist/db/psql/migrations/20260728170500-add_sports_academy_id_to_testimonials.js +0 -21
  198. package/dist/db/psql/migrations/20260729150700-add_sports_academy_id_to_notifications.js +0 -21
  199. package/dist/interfaces/ageGroupInterface.d.ts +0 -12
  200. package/dist/interfaces/assessmentTestInterface.d.ts +0 -23
  201. package/dist/interfaces/equipmentInterface.d.ts +0 -10
  202. package/dist/interfaces/equipmentInterface.js +0 -2
  203. package/dist/interfaces/facilityMasterInterface.d.ts +0 -9
  204. package/dist/interfaces/facilityMasterInterface.js +0 -2
  205. package/dist/interfaces/schoolHasSportInterface.d.ts +0 -7
  206. package/dist/interfaces/schoolHasSportInterface.js +0 -2
  207. package/dist/interfaces/skillInterface.d.ts +0 -19
  208. package/dist/interfaces/skillInterface.js +0 -2
  209. package/dist/interfaces/sportCategoryInterface.d.ts +0 -9
  210. package/dist/interfaces/sportCategoryInterface.js +0 -2
  211. package/dist/interfaces/sportDataApproveInterface.d.ts +0 -19
  212. package/dist/interfaces/sportDataApproveInterface.js +0 -2
  213. package/dist/interfaces/sportGroupDataInterface.d.ts +0 -7
  214. package/dist/interfaces/sportGroupDataInterface.js +0 -2
  215. package/dist/interfaces/sportInfoInterface.d.ts +0 -24
  216. package/dist/interfaces/sportInfoInterface.js +0 -2
  217. package/dist/interfaces/sportInterface.d.ts +0 -10
  218. package/dist/interfaces/sportInterface.js +0 -2
  219. package/dist/interfaces/sportRoleInterface.d.ts +0 -11
  220. package/dist/interfaces/sportRoleInterface.js +0 -2
  221. package/dist/interfaces/sportSubCategoryInterface.d.ts +0 -10
  222. package/dist/interfaces/sportSubCategoryInterface.js +0 -2
  223. package/dist/interfaces/sportsAcademyInterface.d.ts +0 -39
  224. package/dist/interfaces/sportsAcademyInterface.js +0 -2
  225. package/dist/interfaces/studentSportTestInterface.d.ts +0 -20
  226. package/dist/interfaces/studentSportTestInterface.js +0 -2
  227. package/dist/interfaces/unitInterface.d.ts +0 -10
  228. package/dist/interfaces/unitInterface.js +0 -2
  229. package/dist/interfaces/userAcademyMetaInterface.d.ts +0 -17
  230. package/dist/interfaces/userAcademyMetaInterface.js +0 -2
  231. package/dist/interfaces/userAmenityInterface.d.ts +0 -24
  232. package/dist/interfaces/userAmenityInterface.js +0 -2
  233. package/dist/models/mongodb/assessmentTestModel.d.ts +0 -4
  234. package/dist/models/mongodb/assessmentTestModel.js +0 -72
  235. package/dist/models/mongodb/sportDataApproveModel.d.ts +0 -4
  236. package/dist/models/mongodb/sportDataApproveModel.js +0 -117
  237. package/dist/models/mongodb/sportInfoModel.d.ts +0 -4
  238. package/dist/models/mongodb/sportInfoModel.js +0 -72
  239. package/dist/models/mongodb/sportsAcademyModel.d.ts +0 -4
  240. package/dist/models/mongodb/sportsAcademyModel.js +0 -89
  241. package/dist/models/mongodb/studentSportTestModel.d.ts +0 -4
  242. package/dist/models/mongodb/studentSportTestModel.js +0 -68
  243. package/dist/models/mongodb/userAcademyMetaModel.d.ts +0 -4
  244. package/dist/models/mongodb/userAcademyMetaModel.js +0 -109
  245. package/dist/models/mongodb/userAmenityModel.d.ts +0 -4
  246. package/dist/models/mongodb/userAmenityModel.js +0 -73
  247. package/dist/models/psql/ageGroupModel.d.ts +0 -22
  248. package/dist/models/psql/ageGroupModel.js +0 -76
  249. package/dist/models/psql/equipmentModel.d.ts +0 -20
  250. package/dist/models/psql/equipmentModel.js +0 -57
  251. package/dist/models/psql/facilityMasterModel.d.ts +0 -18
  252. package/dist/models/psql/facilityMasterModel.js +0 -64
  253. package/dist/models/psql/schoolHasSportModel.d.ts +0 -17
  254. package/dist/models/psql/schoolHasSportModel.js +0 -76
  255. package/dist/models/psql/skillModel.d.ts +0 -25
  256. package/dist/models/psql/skillModel.js +0 -99
  257. package/dist/models/psql/sportCategoryModel.d.ts +0 -19
  258. package/dist/models/psql/sportCategoryModel.js +0 -53
  259. package/dist/models/psql/sportGroupDataModel.d.ts +0 -13
  260. package/dist/models/psql/sportGroupDataModel.js +0 -64
  261. package/dist/models/psql/sportModel.d.ts +0 -20
  262. package/dist/models/psql/sportModel.js +0 -58
  263. package/dist/models/psql/sportRoleModel.d.ts +0 -21
  264. package/dist/models/psql/sportRoleModel.js +0 -71
  265. package/dist/models/psql/sportSubCategoryModel.d.ts +0 -20
  266. package/dist/models/psql/sportSubCategoryModel.js +0 -75
  267. package/dist/models/psql/unitModel.d.ts +0 -20
  268. package/dist/models/psql/unitModel.js +0 -57
  269. package/dist/types/ageGroupType.d.ts +0 -2
  270. package/dist/types/ageGroupType.js +0 -2
  271. package/dist/types/assessmentTestType.d.ts +0 -2
  272. package/dist/types/assessmentTestType.js +0 -2
  273. package/dist/types/equipmentType.d.ts +0 -2
  274. package/dist/types/equipmentType.js +0 -2
  275. package/dist/types/facilityMasterType.d.ts +0 -3
  276. package/dist/types/facilityMasterType.js +0 -2
  277. package/dist/types/schoolHasSportType.d.ts +0 -2
  278. package/dist/types/schoolHasSportType.js +0 -2
  279. package/dist/types/skillType.d.ts +0 -2
  280. package/dist/types/skillType.js +0 -2
  281. package/dist/types/sportCategoryType.d.ts +0 -2
  282. package/dist/types/sportCategoryType.js +0 -2
  283. package/dist/types/sportDataApproveType.d.ts +0 -2
  284. package/dist/types/sportDataApproveType.js +0 -2
  285. package/dist/types/sportGroupDataType.d.ts +0 -3
  286. package/dist/types/sportGroupDataType.js +0 -2
  287. package/dist/types/sportInfoType.d.ts +0 -2
  288. package/dist/types/sportInfoType.js +0 -2
  289. package/dist/types/sportRoleType.d.ts +0 -2
  290. package/dist/types/sportRoleType.js +0 -2
  291. package/dist/types/sportSubCategoryType.d.ts +0 -2
  292. package/dist/types/sportSubCategoryType.js +0 -2
  293. package/dist/types/sportType.d.ts +0 -2
  294. package/dist/types/sportType.js +0 -2
  295. package/dist/types/sportsAcademyType.d.ts +0 -2
  296. package/dist/types/sportsAcademyType.js +0 -2
  297. package/dist/types/studentSportTestType.d.ts +0 -2
  298. package/dist/types/studentSportTestType.js +0 -2
  299. package/dist/types/unitType.d.ts +0 -2
  300. package/dist/types/unitType.js +0 -2
  301. package/dist/types/userAcademyMetaType.d.ts +0 -2
  302. package/dist/types/userAcademyMetaType.js +0 -2
  303. package/dist/types/userAmenityType.d.ts +0 -2
  304. package/dist/types/userAmenityType.js +0 -2
  305. /package/dist/db/psql/migrations/{20260714095754-create-arena-models.d.ts → 20260714111425-change_status_enum_to_string_in_institutes.d.ts} +0 -0
  306. /package/dist/db/psql/migrations/{20260722143500-create-school_has_sports.d.ts → 20260714131500-add_note_to_institutes.d.ts} +0 -0
  307. /package/dist/db/psql/migrations/{20260728170500-add_sports_academy_id_to_testimonials.d.ts → 20260715150000-create-ai-model-keys.d.ts} +0 -0
  308. /package/dist/db/psql/migrations/{20260729150700-add_sports_academy_id_to_notifications.d.ts → 20260727123149-add_vendorCompanyId_to_institute_ownership_histories.d.ts} +0 -0
  309. /package/dist/interfaces/{ageGroupInterface.js → aiModelKeysInterface.js} +0 -0
  310. /package/dist/{interfaces/assessmentTestInterface.js → types/aiModelKeysType.js} +0 -0
@@ -0,0 +1,27 @@
1
+ import Joi from 'joi';
2
+ import { Request, Response, NextFunction } from 'express';
3
+ import BaseValidator from './joiSchemaBuilder';
4
+ import { CrudValidatorRules } from '../types/commonType';
5
+ export default class BaseCrudValidator<TModel extends Record<string, any>, TKeys extends Extract<keyof TModel, string> = Extract<keyof TModel, string>> extends BaseValidator {
6
+ protected baseSchema: Joi.ObjectSchema<any>;
7
+ protected rules: CrudValidatorRules<TKeys>;
8
+ constructor(baseSchema: Joi.ObjectSchema<any>, rules?: CrudValidatorRules<TKeys>);
9
+ /** MERGE RULES */
10
+ private mergeRules;
11
+ /** APPLY DEFAULT ID RULE */
12
+ private applyDefaultIdRule;
13
+ /** Nested Required for */
14
+ private applyNestedRequired;
15
+ /** CREATE */
16
+ createValidator: (req: Request, res: Response, next: NextFunction) => void;
17
+ /** UPDATE */
18
+ updateValidator: (req: Request, res: Response, next: NextFunction) => void;
19
+ /** DELETE */
20
+ deleteValidator: (req: Request, res: Response, next: NextFunction) => void;
21
+ /** GET BY ID */
22
+ getByIdValidator: (req: Request, res: Response, next: NextFunction) => void;
23
+ /** GET ALL */
24
+ getAllValidator: (req: Request, res: Response, next: NextFunction) => void;
25
+ /** GET ALL WITH PAGINATION */
26
+ getAllWithPaginationValidator: (req: Request, res: Response, next: NextFunction) => void;
27
+ }
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const joi_1 = __importDefault(require("joi"));
40
+ const joiSchemaBuilder_1 = __importStar(require("./joiSchemaBuilder"));
41
+ const joiCommonValidator_1 = require("./joiCommonValidator");
42
+ class BaseCrudValidator extends joiSchemaBuilder_1.default {
43
+ constructor(baseSchema, rules = {}) {
44
+ super();
45
+ /** CREATE */
46
+ this.createValidator = (req, res, next) => {
47
+ try {
48
+ const mergedRules = this.mergeRules({}, this.rules.create);
49
+ let schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
50
+ if (mergedRules.nestedRequired?.length) {
51
+ schema = this.applyNestedRequired(schema, mergedRules.nestedRequired);
52
+ }
53
+ this.validate(schema, req);
54
+ next();
55
+ }
56
+ catch (err) {
57
+ next(err);
58
+ }
59
+ };
60
+ /** UPDATE */
61
+ this.updateValidator = (req, res, next) => {
62
+ try {
63
+ const idRules = this.applyDefaultIdRule(this.rules.update);
64
+ const mergedRules = this.mergeRules({}, idRules);
65
+ let schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
66
+ if (mergedRules.nestedRequired?.length) {
67
+ schema = this.applyNestedRequired(schema, mergedRules.nestedRequired);
68
+ }
69
+ this.validate(schema, req);
70
+ next();
71
+ }
72
+ catch (err) {
73
+ next(err);
74
+ }
75
+ };
76
+ /** DELETE */
77
+ this.deleteValidator = (req, res, next) => {
78
+ try {
79
+ const idRules = this.applyDefaultIdRule(this.rules.delete);
80
+ const mergedRules = this.mergeRules({}, idRules);
81
+ const schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
82
+ this.validate(schema, req);
83
+ next();
84
+ }
85
+ catch (err) {
86
+ next(err);
87
+ }
88
+ };
89
+ /** GET BY ID */
90
+ this.getByIdValidator = (req, res, next) => {
91
+ try {
92
+ const idRules = this.applyDefaultIdRule(this.rules.getById);
93
+ const mergedRules = this.mergeRules({}, idRules);
94
+ const schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
95
+ this.validate(schema, req);
96
+ next();
97
+ }
98
+ catch (err) {
99
+ next(err);
100
+ }
101
+ };
102
+ /** GET ALL */
103
+ this.getAllValidator = (req, res, next) => {
104
+ try {
105
+ const mergedRules = this.mergeRules({}, this.rules.getAll);
106
+ const schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
107
+ this.validate(schema, req);
108
+ next();
109
+ }
110
+ catch (err) {
111
+ next(err);
112
+ }
113
+ };
114
+ /** GET ALL WITH PAGINATION */
115
+ this.getAllWithPaginationValidator = (req, res, next) => {
116
+ try {
117
+ const mergedRules = this.mergeRules({ customFields: joiCommonValidator_1.paginationValidators }, this.rules.getAllWithPagination ?? this.rules.getAll);
118
+ const schema = (0, joiSchemaBuilder_1.buildSchema)(this.baseSchema, mergedRules);
119
+ this.validate(schema, req);
120
+ next();
121
+ }
122
+ catch (err) {
123
+ next(err);
124
+ }
125
+ };
126
+ this.baseSchema = baseSchema;
127
+ this.rules = rules;
128
+ }
129
+ /** MERGE RULES */
130
+ mergeRules(defaultRules, overrideRules) {
131
+ const defaultCustomFields = {
132
+ search: joi_1.default.string().optional().allow(null),
133
+ };
134
+ return {
135
+ ...defaultRules,
136
+ ...overrideRules,
137
+ required: [...(defaultRules.required || []), ...(overrideRules?.required || [])],
138
+ optional: [...(defaultRules.optional || []), ...(overrideRules?.optional || [])],
139
+ allowNull: [...(defaultRules.allowNull || []), ...(overrideRules?.allowNull || [])],
140
+ forbidden: [...(defaultRules.forbidden || []), ...(overrideRules?.forbidden || [])],
141
+ singleOrArray: [...(defaultRules.singleOrArray || []), ...(overrideRules?.singleOrArray || [])],
142
+ singleOrArrayOrNull: [...(defaultRules.singleOrArrayOrNull || []), ...(overrideRules?.singleOrArrayOrNull || [])],
143
+ nestedRequired: [...(defaultRules.nestedRequired || []), ...(overrideRules?.nestedRequired || [])],
144
+ customFields: {
145
+ ...defaultCustomFields,
146
+ ...(defaultRules.customFields || {}),
147
+ ...(overrideRules?.customFields || {}),
148
+ },
149
+ };
150
+ }
151
+ /** APPLY DEFAULT ID RULE */
152
+ applyDefaultIdRule(override) {
153
+ const overrideHasId = override?.required?.includes('id') ||
154
+ override?.optional?.includes('id') ||
155
+ override?.forbidden?.includes('id');
156
+ if (override && overrideHasId)
157
+ return override;
158
+ if (override)
159
+ return override;
160
+ return { required: ['id'] };
161
+ }
162
+ /** Nested Required for */
163
+ // private applyNestedRequired(schema: Joi.ObjectSchema, paths: string[]): Joi.ObjectSchema {
164
+ // return schema.custom((value, helpers) => {
165
+ // for (const path of paths) {
166
+ // const keys = path.split('.');
167
+ // let current: any = value;
168
+ // let fullPath = '';
169
+ // for (const key of keys) {
170
+ // if (Array.isArray(current)) {
171
+ // if (!current.length) {
172
+ // return helpers.message(`"${fullPath || path}" is required`);
173
+ // }
174
+ // current = current[0];
175
+ // fullPath += '[0]';
176
+ // }
177
+ // fullPath = fullPath ? `${fullPath}.${key}` : key;
178
+ // if (current?.[key] === undefined) {
179
+ // return helpers.message(`"${fullPath}" is required`);
180
+ // }
181
+ // current = current[key];
182
+ // }
183
+ // }
184
+ // return value;
185
+ // });
186
+ // }
187
+ applyNestedRequired(schema, paths) {
188
+ return schema
189
+ .custom((value, helpers) => {
190
+ const checkPath = (current, keys, basePath = '') => {
191
+ if (!keys.length)
192
+ return null;
193
+ const [key, ...rest] = keys;
194
+ if (Array.isArray(current)) {
195
+ for (let i = 0; i < current.length; i++) {
196
+ const result = checkPath(current[i], keys, `${basePath}[${i}]`);
197
+ if (result)
198
+ return result;
199
+ }
200
+ return null;
201
+ }
202
+ const nextValue = current?.[key];
203
+ const currentPath = basePath ? `${basePath}.${key}` : key;
204
+ if (nextValue === undefined) {
205
+ return currentPath;
206
+ }
207
+ return checkPath(nextValue, rest, currentPath);
208
+ };
209
+ for (const path of paths) {
210
+ const keys = path.split('.');
211
+ const missingPath = checkPath(value, keys);
212
+ if (missingPath) {
213
+ return helpers.error('any.custom', {
214
+ path: missingPath,
215
+ });
216
+ }
217
+ }
218
+ return value;
219
+ })
220
+ .messages({
221
+ 'any.custom': '"{{#path}}" is required',
222
+ });
223
+ }
224
+ }
225
+ exports.default = BaseCrudValidator;
@@ -0,0 +1,3 @@
1
+ export * from './joiSchemaBuilder';
2
+ export * from './joiCommonValidator';
3
+ export { default as BaseValidator } from './joiSchemaBuilder';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.BaseValidator = void 0;
21
+ __exportStar(require("./joiSchemaBuilder"), exports);
22
+ __exportStar(require("./joiCommonValidator"), exports);
23
+ var joiSchemaBuilder_1 = require("./joiSchemaBuilder");
24
+ Object.defineProperty(exports, "BaseValidator", { enumerable: true, get: function () { return __importDefault(joiSchemaBuilder_1).default; } });
@@ -0,0 +1,12 @@
1
+ import Joi from 'joi';
2
+ export declare const paginationValidators: {
3
+ page: Joi.NumberSchema<number>;
4
+ limit: Joi.NumberSchema<number>;
5
+ search: Joi.StringSchema<string>;
6
+ isPaginate: Joi.BooleanSchema<boolean>;
7
+ order: Joi.ArraySchema<string[][]>;
8
+ sort: Joi.StringSchema<string>;
9
+ };
10
+ export declare const enumAlternatives: (enumObj: Record<string, string>, isRequired?: boolean, allowArray?: boolean) => Joi.StringSchema<string> | Joi.AlternativesSchema<any>;
11
+ export declare const objectIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
12
+ export declare const uuidIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.uuidIdAlternatives = exports.objectIdAlternatives = exports.enumAlternatives = exports.paginationValidators = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ exports.paginationValidators = {
9
+ page: joi_1.default.number().integer().min(1).default(1),
10
+ limit: joi_1.default.number().integer().min(1).default(10),
11
+ search: joi_1.default.string().trim(),
12
+ isPaginate: joi_1.default.boolean().default(true),
13
+ order: joi_1.default.array().items(joi_1.default.array().items(joi_1.default.string().trim(), joi_1.default.string().trim())),
14
+ sort: joi_1.default.string()
15
+ .pattern(/^(-?\\w+(,-?\\w+)*)?$/)
16
+ .optional()
17
+ .messages({
18
+ 'string.pattern.base': `"sort" must be a comma-separated list of field names, optionally prefixed with '-' for descending`,
19
+ }),
20
+ };
21
+ const enumAlternatives = (enumObj, isRequired = false, allowArray = true) => {
22
+ const base = joi_1.default.string().valid(...Object.values(enumObj));
23
+ if (allowArray) {
24
+ const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
25
+ return isRequired ? alt.required() : alt.optional();
26
+ }
27
+ return isRequired ? base.required() : base.optional();
28
+ };
29
+ exports.enumAlternatives = enumAlternatives;
30
+ const objectIdAlternatives = (isRequired = false, allowArray = true) => {
31
+ const base = joi_1.default.string()
32
+ .pattern(/^[0-9a-fA-F]{24}$/)
33
+ .message('Invalid ObjectId format');
34
+ if (allowArray) {
35
+ const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
36
+ return isRequired ? alt.required() : alt.optional();
37
+ }
38
+ };
39
+ exports.objectIdAlternatives = objectIdAlternatives;
40
+ const uuidIdAlternatives = (isRequired = false, allowArray = true) => {
41
+ const base = joi_1.default.string().uuid().message('Invalid Uuid format');
42
+ if (allowArray) {
43
+ const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
44
+ return isRequired ? alt.required() : alt.optional();
45
+ }
46
+ };
47
+ exports.uuidIdAlternatives = uuidIdAlternatives;
@@ -0,0 +1,6 @@
1
+ import Joi from 'joi';
2
+ import { SchemaRules } from '../types/commonType';
3
+ export declare const buildSchema: <TModel extends Record<string, any>, Keys extends keyof TModel & string = keyof TModel & string>(base: Joi.ObjectSchema<TModel>, rules?: SchemaRules<Keys>) => Joi.ObjectSchema<TModel>;
4
+ export default class BaseValidator {
5
+ protected validate(schema: Joi.ObjectSchema, req: any, options?: Joi.ValidationOptions): void;
6
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildSchema = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ const httpStatusCode_1 = require("../constants/httpStatusCode");
9
+ class ApiError extends Error {
10
+ constructor(statusCode, message, isOperational = true, stack = '') {
11
+ super(message);
12
+ this.statusCode = statusCode;
13
+ this.isOperational = isOperational;
14
+ if (stack) {
15
+ this.stack = stack;
16
+ }
17
+ else {
18
+ Error.captureStackTrace(this, this.constructor);
19
+ }
20
+ }
21
+ }
22
+ // GENERIC BUILDER
23
+ const buildSchema = (base, rules = {}) => {
24
+ let schema = base;
25
+ // REQUIRED
26
+ if (rules.required) {
27
+ schema = schema.fork(rules.required, field => field.required());
28
+ }
29
+ // OPTIONAL
30
+ if (rules.optional) {
31
+ schema = schema.fork(rules.optional, field => field.optional());
32
+ }
33
+ // ALLOW NULL
34
+ if (rules.allowNull) {
35
+ schema = schema.fork(rules.allowNull, field => field.allow(null));
36
+ }
37
+ // FORBIDDEN
38
+ if (rules.forbidden) {
39
+ schema = schema.fork(rules.forbidden, field => field.forbidden());
40
+ }
41
+ // SINGLE OR ARRAY
42
+ if (rules.singleOrArray) {
43
+ schema = schema.fork(rules.singleOrArray, field => joi_1.default.alternatives().try(field, joi_1.default.array().items(field)));
44
+ }
45
+ // SINGLE OR ARRAY OR NULL
46
+ if (rules.singleOrArrayOrNull) {
47
+ schema = schema.fork(rules.singleOrArrayOrNull, field => joi_1.default.alternatives().try(field, joi_1.default.array().items(field), joi_1.default.valid(null)));
48
+ }
49
+ // CUSTOM FIELDS
50
+ if (rules.customFields) {
51
+ schema = schema.append(rules.customFields);
52
+ }
53
+ return schema;
54
+ };
55
+ exports.buildSchema = buildSchema;
56
+ const defaultOptions = {
57
+ abortEarly: false,
58
+ allowUnknown: false,
59
+ };
60
+ class BaseValidator {
61
+ validate(schema, req, options) {
62
+ const { error, value } = schema.validate({ ...req.body, ...req.query, ...req.params }, { ...defaultOptions, ...options });
63
+ if (error) {
64
+ const errorMessage = error.details.map(d => d.message).join(', ');
65
+ throw new ApiError(httpStatusCode_1.HTTP_STATUS_CODE.BAD_REQUEST, errorMessage);
66
+ }
67
+ req.body = value;
68
+ }
69
+ }
70
+ exports.default = BaseValidator;
@@ -59,4 +59,6 @@ export declare const ENV_VARIABLE: {
59
59
  API_KEY: any;
60
60
  ENDPOINT: any;
61
61
  };
62
+ REDIS_HOST: any;
63
+ DUMMY_EMAIL_DOMAIN: any;
62
64
  };
@@ -102,6 +102,8 @@ const envValidation = joi_1.default.object()
102
102
  PHONEPE_PASSWORD: joi_1.default.string().optional(),
103
103
  GOOGLEPAY_API_KEY: joi_1.default.string().optional(),
104
104
  GOOGLEPAY_ENDPOINT: joi_1.default.string().optional(),
105
+ REDIS_HOST: joi_1.default.string().optional(),
106
+ DUMMY_EMAIL_DOMAIN: joi_1.default.string().optional(),
105
107
  })
106
108
  .unknown();
107
109
  const { value: envVar, error } = envValidation.prefs({ errors: { label: 'key' } }).validate(process.env);
@@ -170,4 +172,6 @@ exports.ENV_VARIABLE = {
170
172
  API_KEY: envVar.GOOGLEPAY_API_KEY,
171
173
  ENDPOINT: envVar.GOOGLEPAY_ENDPOINT,
172
174
  },
175
+ REDIS_HOST: envVar.REDIS_HOST,
176
+ DUMMY_EMAIL_DOMAIN: envVar.DUMMY_EMAIL_DOMAIN,
173
177
  };
@@ -1,2 +1,4 @@
1
1
  export * from './aws';
2
2
  export * from './env';
3
+ export * from './logger';
4
+ export * from './redisConfig';
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./aws"), exports);
18
18
  __exportStar(require("./env"), exports);
19
+ __exportStar(require("./logger"), exports);
20
+ __exportStar(require("./redisConfig"), exports);
@@ -0,0 +1,2 @@
1
+ import winston from 'winston';
2
+ export declare const logger: winston.Logger;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = void 0;
7
+ const winston_1 = __importDefault(require("winston"));
8
+ const winston_daily_rotate_file_1 = __importDefault(require("winston-daily-rotate-file"));
9
+ const env_1 = require("../configs/env");
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const enumerateErrorFormat = winston_1.default.format((info) => {
12
+ if (info.message instanceof Error) {
13
+ info.message = {
14
+ message: info.message.message,
15
+ stack: info.message.stack,
16
+ ...info.message,
17
+ };
18
+ }
19
+ if (info instanceof Error) {
20
+ return {
21
+ // message: info.message,
22
+ stack: info.stack,
23
+ ...info,
24
+ };
25
+ }
26
+ return info;
27
+ });
28
+ const transport = new winston_daily_rotate_file_1.default({
29
+ filename: env_1.ENV_VARIABLE.LOG_FOLDER + env_1.ENV_VARIABLE.LOG_FILE,
30
+ datePattern: 'YYYY-MM-DD',
31
+ zippedArchive: true,
32
+ maxSize: '20m',
33
+ maxFiles: '3',
34
+ // prepend: true,
35
+ });
36
+ exports.logger = winston_1.default.createLogger({
37
+ format: winston_1.default.format.combine(enumerateErrorFormat(), winston_1.default.format.json()),
38
+ transports: [
39
+ transport,
40
+ new winston_1.default.transports.Console({
41
+ level: 'info',
42
+ }),
43
+ ],
44
+ });
@@ -0,0 +1,4 @@
1
+ import Redis from 'ioredis';
2
+ declare const redisClient: Redis;
3
+ export declare const connectRedis: () => Promise<void>;
4
+ export default redisClient;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.connectRedis = void 0;
7
+ const ioredis_1 = __importDefault(require("ioredis"));
8
+ const logger_1 = require("./logger");
9
+ const env_1 = require("./env");
10
+ // const redisClient = new Redis(ENV_VARIABLE.REDIS_URL, {
11
+ // maxRetriesPerRequest: null,
12
+ // });
13
+ const redisClient = new ioredis_1.default({
14
+ host: env_1.ENV_VARIABLE.REDIS_HOST || 'redis',
15
+ port: 6379,
16
+ maxRetriesPerRequest: null,
17
+ });
18
+ redisClient.on('error', err => {
19
+ console.error('Redis Client Error', err);
20
+ logger_1.logger.error(err);
21
+ });
22
+ const connectRedis = async () => {
23
+ // ioredis connects automatically, but we can check the status
24
+ if (redisClient.status === 'ready')
25
+ return;
26
+ return new Promise((resolve, reject) => {
27
+ redisClient.once('ready', () => resolve());
28
+ redisClient.once('error', err => reject(err));
29
+ });
30
+ };
31
+ exports.connectRedis = connectRedis;
32
+ exports.default = redisClient;