@kipicore/dbcore 1.1.0 → 1.1.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 (563) hide show
  1. package/dist/scripts/fix-import-extensions.js +12 -7
  2. package/dist/scripts/generate-index.js +12 -7
  3. package/dist/src/configs/aws.js +9 -6
  4. package/dist/src/configs/env.js +56 -17
  5. package/dist/src/configs/postgresConfig.js +1 -1
  6. package/dist/src/constants/app.js +318 -312
  7. package/dist/src/constants/defaultModelAttributes.js +12 -9
  8. package/dist/src/constants/errorMessages.js +219 -214
  9. package/dist/src/constants/httpStatusCode.js +5 -2
  10. package/dist/src/constants/successMessages.js +223 -217
  11. package/dist/src/db/mongodb.js +10 -3
  12. package/dist/src/db/postgres.js +5 -2
  13. package/dist/src/db/psql/index.js +1 -1
  14. package/dist/src/db/psql/migrations/20241225101052-add-deleted-by-and-deleted-at-fields.js +0 -1
  15. package/dist/src/db/psql/migrations/20250106070945-add-user-fields-and-deleted-user-fields.js +0 -1
  16. package/dist/src/db/psql/migrations/20250106080059-add-fields-and-deleted-fields.js +0 -1
  17. package/dist/src/db/psql/migrations/20250108092439-update-batch-model-fields.js +0 -1
  18. package/dist/src/db/psql/migrations/20250210102846-add-profileImage-coverImage-to-users.js +0 -1
  19. package/dist/src/db/psql/migrations/20250211071743-add-action-user-has-histroy.js +0 -1
  20. package/dist/src/db/psql/migrations/20250213140815-add-assignQuantity-user-has-histroy.js +0 -1
  21. package/dist/src/db/psql/migrations/20250214072626-add-middlename-user.js +0 -1
  22. package/dist/src/db/psql/migrations/20250224085333-add-apptype-in-user.js +0 -1
  23. package/dist/src/db/psql/migrations/20250226053006-add-brouchure-in-institute.js +0 -1
  24. package/dist/src/db/psql/migrations/20250227123530-add-defult-in-fee-reminder.js +0 -1
  25. package/dist/src/db/psql/migrations/20250304052831-add-institued-in-school-data-clm.js +0 -1
  26. package/dist/src/db/psql/migrations/20250306053557-add-shifyId-in-batch.js +0 -1
  27. package/dist/src/db/psql/migrations/20250311044606-add-institued-in-school-data-clm-subtype.js +0 -1
  28. package/dist/src/db/psql/migrations/20250402090653-add-user-area.js +0 -1
  29. package/dist/src/db/psql/migrations/20250407094125-update-type-in-typeManagement.js +0 -1
  30. package/dist/src/db/psql/migrations/20250409105229-add-user-type-in-role.js +0 -1
  31. package/dist/src/db/psql/migrations/20250417121316-make-institute-id-nullable-in-type-management.js +0 -1
  32. package/dist/src/db/psql/migrations/20250419071236-fee_histroy_add_school_clm.js +0 -1
  33. package/dist/src/db/psql/migrations/20250419085334-fee_histroy_add_school_clm.js +0 -1
  34. package/dist/src/db/psql/migrations/20250421085618-add-entityIds-field-in-announcements.js +0 -1
  35. package/dist/src/db/psql/migrations/20250422114032-add-account.js +0 -1
  36. package/dist/src/db/psql/migrations/20250423051841-add-master-leave-clm.js +0 -1
  37. package/dist/src/db/psql/migrations/20250423064522-update-calender-enum.js +0 -1
  38. package/dist/src/db/psql/migrations/20250423093827-update-institued-district.js +0 -1
  39. package/dist/src/db/psql/migrations/20250424044755-update-fee-history-feeTyps-clm.js +0 -1
  40. package/dist/src/db/psql/migrations/20250424053841-update-fee-history-key.js +1 -1
  41. package/dist/src/db/psql/migrations/20250426070309-update-banner-clm-userType.js +0 -1
  42. package/dist/src/db/psql/migrations/20250505035157-update-fee-collection-clm-add.js +0 -1
  43. package/dist/src/db/psql/migrations/20250505082924-update-banner-clm.js +0 -1
  44. package/dist/src/db/psql/migrations/20250505094616-about-as-clm-in-institued.js +0 -1
  45. package/dist/src/db/psql/migrations/20250506070110-add-dayOfWeek-clm-in-working-model.js +0 -1
  46. package/dist/src/db/psql/migrations/20250509055920-add-feecollection-isleft-clm.js +0 -1
  47. package/dist/src/db/psql/migrations/20250513061037-add-techer-clm-batch.js +0 -1
  48. package/dist/src/db/psql/migrations/20250514101801-add-slotId-workingShif.js +0 -1
  49. package/dist/src/db/psql/migrations/20250516062917-add-globalId-clm-user-model.js +0 -1
  50. package/dist/src/db/psql/migrations/20250516063542-add-globalId-clm-institute-model.js +0 -1
  51. package/dist/src/db/psql/migrations/20250520061231-add-institued_mobile_person_data.js +0 -1
  52. package/dist/src/db/psql/migrations/20250522044729-add-institued_update_add_2.js +0 -1
  53. package/dist/src/db/psql/migrations/20250526035543-add-totalQuantity_add_remainingQuantiy_clm_userHasInventoryHistory.js +0 -1
  54. package/dist/src/db/psql/migrations/20250526093322-add-appType_clm_in_module.js +0 -1
  55. package/dist/src/db/psql/migrations/20250526094030-add-appType_clm_in_action.js +0 -1
  56. package/dist/src/db/psql/migrations/20250526094233-add-appType_clm_in_module_features.js +0 -1
  57. package/dist/src/db/psql/migrations/20250527065001-add-app-type-in-role-model.js +0 -1
  58. package/dist/src/db/psql/migrations/20250528045906-add-module-type-to-notifications.js +0 -1
  59. package/dist/src/db/psql/migrations/20250602090331-add-or-update-user-model-medicalHistory.js +0 -1
  60. package/dist/src/db/psql/migrations/20250602100550-add-planner-sync-status-to-institute.js +0 -1
  61. package/dist/src/db/psql/migrations/20250603054900-add-clm-for-defult-data-add-or-not-in-ins-model.js +0 -1
  62. package/dist/src/db/psql/migrations/20250604103905-add-is-institute-default-field-in-role.js +0 -1
  63. package/dist/src/db/psql/migrations/20250604121051-update-mobile-number-opstion.js +0 -1
  64. package/dist/src/db/psql/migrations/20250617064159-update-type-management-jun-17.js +0 -1
  65. package/dist/src/db/psql/migrations/20250627065013-is-institute-default-added-type-managemente.js +0 -1
  66. package/dist/src/db/psql/migrations/20250701095321-add-clm-institute-pdfId.js +0 -1
  67. package/dist/src/db/psql/migrations/20250704102117-add-clm-isDefult-in-typeManagemet.js +0 -1
  68. package/dist/src/db/psql/migrations/20250715103324-add-academic-calendar-id-to-batches.js +0 -1
  69. package/dist/src/db/psql/migrations/20250715121047-remove-batch-id-from-academic-calendars.js +0 -1
  70. package/dist/src/db/psql/migrations/20250716131731-rename-user-id-to-primary-user-id.js +0 -1
  71. package/dist/src/db/psql/migrations/20250717092933-add-floor-id-to-class-rooms.js +0 -1
  72. package/dist/src/db/psql/migrations/20250718121251-add-clm-classroom-typeid.js +0 -1
  73. package/dist/src/db/psql/migrations/20250721065317-add-instituteId-fileSize-to-fileStorage.js +0 -1
  74. package/dist/src/db/psql/migrations/20250721100004-add-shift-slot-id-to-lectures.js +0 -1
  75. package/dist/src/db/psql/migrations/20250721105455-add-clm-classroom-add-classroomnumber.js +0 -1
  76. package/dist/src/db/psql/migrations/20250722071836-add-title-to-floor-management.js +0 -1
  77. package/dist/src/db/psql/migrations/20250723150111-add-clm-batch-slotId.js +0 -1
  78. package/dist/src/db/psql/migrations/20250724062458-update_classRoom_number_clm_to_string.js +0 -1
  79. package/dist/src/db/psql/migrations/20250725132424-add-unique-index-on-instituteId-name-type.js +0 -1
  80. package/dist/src/db/psql/migrations/20250730104844-update-unique-key-assessment-type.js +0 -1
  81. package/dist/src/db/psql/migrations/20250804090437-update_ins_in_pdf_id_string_to_uuid.js +0 -1
  82. package/dist/src/db/psql/migrations/20250805062440-remove_unique_key_into_batch_subject_project_assessments.js +0 -1
  83. package/dist/src/db/psql/migrations/20250805115805-add-descriptions-to-lectures.js +0 -1
  84. package/dist/src/db/psql/migrations/20250808100700-add_clm_contectFeed_in_ins_givenId.js +0 -1
  85. package/dist/src/db/psql/migrations/20250808101515-add-sequence-to-institute_entities.js +0 -1
  86. package/dist/src/db/psql/migrations/20250812080521-add-title-and-descriptions-to-batch-subject-project-assessments.js +0 -1
  87. package/dist/src/db/psql/migrations/20250820092836-add-sequence-number-to-institute-entities.js +0 -1
  88. package/dist/src/db/psql/migrations/20250829103203-remove-syllabus-composit-index.js +0 -1
  89. package/dist/src/db/psql/migrations/20250905132024-add-uuid-to-users.js +0 -1
  90. package/dist/src/db/psql/migrations/20250908054025-userHasOffer_model_update.js +0 -1
  91. package/dist/src/db/psql/migrations/20250908054754-offer_in_add_offertype_clm.js +0 -1
  92. package/dist/src/db/psql/migrations/20250909061117-add-instituteId-isDefault-to-entityGroup.js +0 -1
  93. package/dist/src/db/psql/migrations/20250911060106-change-wallet-history-columns-to-float.js +0 -1
  94. package/dist/src/db/psql/migrations/20250911060245-change-coin-to-float-in-wallets.js +0 -1
  95. package/dist/src/db/psql/migrations/20250917135646-change-storageInBytes-to-float.js +0 -1
  96. package/dist/src/db/psql/seeders/20240809100759-add-countries-states-cities.js +1 -1
  97. package/dist/src/db/psql/seeders/20250101122757-add-default-permissions-modules.js +0 -1
  98. package/dist/src/db/psql/seeders/Data/AcademicCalendarModule.js +1 -1
  99. package/dist/src/db/psql/seeders/Data/AdministrativeStaffModule.js +1 -1
  100. package/dist/src/db/psql/seeders/Data/AnnouncementsModule.js +1 -1
  101. package/dist/src/db/psql/seeders/Data/AssetsModule.js +1 -1
  102. package/dist/src/db/psql/seeders/Data/AttendanceModule.js +1 -1
  103. package/dist/src/db/psql/seeders/Data/BannerModule.js +1 -1
  104. package/dist/src/db/psql/seeders/Data/BatchModule.js +1 -1
  105. package/dist/src/db/psql/seeders/Data/BoardModule .js +1 -1
  106. package/dist/src/db/psql/seeders/Data/BookAssessmentsModule.js +1 -1
  107. package/dist/src/db/psql/seeders/Data/CategoriesModule.js +1 -1
  108. package/dist/src/db/psql/seeders/Data/ClassroomModule.js +1 -1
  109. package/dist/src/db/psql/seeders/Data/DivisionModule.js +1 -1
  110. package/dist/src/db/psql/seeders/Data/EventModule.js +1 -1
  111. package/dist/src/db/psql/seeders/Data/ExamsAndResultsModule.js +1 -1
  112. package/dist/src/db/psql/seeders/Data/FacilityModule.js +1 -1
  113. package/dist/src/db/psql/seeders/Data/FeeAndDiscountModule.js +1 -1
  114. package/dist/src/db/psql/seeders/Data/FeedBackModule.js +1 -1
  115. package/dist/src/db/psql/seeders/Data/FileModule.js +1 -1
  116. package/dist/src/db/psql/seeders/Data/GenerateIdModule.js +1 -1
  117. package/dist/src/db/psql/seeders/Data/HolidayModule.js +1 -1
  118. package/dist/src/db/psql/seeders/Data/HomeworkModule.js +1 -1
  119. package/dist/src/db/psql/seeders/Data/IndexModule.js +1 -1
  120. package/dist/src/db/psql/seeders/Data/InquiryModule.js +1 -1
  121. package/dist/src/db/psql/seeders/Data/InstituteModule.js +1 -1
  122. package/dist/src/db/psql/seeders/Data/InventoryModule.js +1 -1
  123. package/dist/src/db/psql/seeders/Data/JobApplyModule.js +1 -1
  124. package/dist/src/db/psql/seeders/Data/LectureModule.js +1 -1
  125. package/dist/src/db/psql/seeders/Data/ParentModule.js +1 -1
  126. package/dist/src/db/psql/seeders/Data/PayoutModule.js +1 -1
  127. package/dist/src/db/psql/seeders/Data/PdcChequesModule.js +1 -1
  128. package/dist/src/db/psql/seeders/Data/PhotosGalleryModule.js +1 -1
  129. package/dist/src/db/psql/seeders/Data/PlannerModule.js +1 -1
  130. package/dist/src/db/psql/seeders/Data/ProjectAssessmentsModule.js +1 -1
  131. package/dist/src/db/psql/seeders/Data/ReplaceTeacherModule.js +1 -1
  132. package/dist/src/db/psql/seeders/Data/RoleModule.js +1 -1
  133. package/dist/src/db/psql/seeders/Data/RollNumberModule.js +1 -1
  134. package/dist/src/db/psql/seeders/Data/SchoolFeeModule.js +1 -1
  135. package/dist/src/db/psql/seeders/Data/SchoolModule.js +1 -1
  136. package/dist/src/db/psql/seeders/Data/SchoolRegistration.js +1 -1
  137. package/dist/src/db/psql/seeders/Data/SettingsModule.js +1 -1
  138. package/dist/src/db/psql/seeders/Data/StaffTimingModule.js +1 -1
  139. package/dist/src/db/psql/seeders/Data/StudentModule.js +1 -1
  140. package/dist/src/db/psql/seeders/Data/SubjectModule.js +1 -1
  141. package/dist/src/db/psql/seeders/Data/SyllabusManagementModule.js +1 -1
  142. package/dist/src/db/psql/seeders/Data/TeacherModule.js +1 -1
  143. package/dist/src/db/psql/seeders/Data/TestimonialsModule.js +1 -1
  144. package/dist/src/db/psql/seeders/Data/TimetableModule.js +1 -1
  145. package/dist/src/db/psql/seeders/Data/To-doModule.js +1 -1
  146. package/dist/src/db/psql/seeders/Data/TypeManagementModule.js +1 -1
  147. package/dist/src/db/psql/seeders/Data/UserModule.js +1 -1
  148. package/dist/src/db/psql/seeders/Data/appType.js +1 -1
  149. package/dist/src/helpers/s3Uploader.js +25 -17
  150. package/dist/src/helpers/utils.js +148 -69
  151. package/dist/src/index.js +431 -415
  152. package/dist/src/interfaces/academicCalendarInterface.js +2 -1
  153. package/dist/src/interfaces/accountHasReceiptDetailsInterface.js +2 -1
  154. package/dist/src/interfaces/announcementInterface.js +2 -1
  155. package/dist/src/interfaces/approvalRequestInterface.js +2 -1
  156. package/dist/src/interfaces/areaInterface.js +2 -1
  157. package/dist/src/interfaces/attendanceInterface.js +2 -1
  158. package/dist/src/interfaces/bankAccountDetailsInterface.js +2 -1
  159. package/dist/src/interfaces/bannerInterface.js +2 -1
  160. package/dist/src/interfaces/batchInterface.js +2 -1
  161. package/dist/src/interfaces/batchSubjectBookAssessmentInterface.js +2 -1
  162. package/dist/src/interfaces/batchSubjectProjectAssessmentInterface.js +2 -1
  163. package/dist/src/interfaces/blogInterface.js +2 -1
  164. package/dist/src/interfaces/bookAssessmentDateInterface.js +2 -1
  165. package/dist/src/interfaces/careerInterface.js +2 -1
  166. package/dist/src/interfaces/categoriesInterface.js +2 -1
  167. package/dist/src/interfaces/certificatesHistoryInterface.js +2 -1
  168. package/dist/src/interfaces/certificatesManagementInterface.js +2 -1
  169. package/dist/src/interfaces/cityInterface.js +2 -1
  170. package/dist/src/interfaces/classRoomInterface.js +2 -1
  171. package/dist/src/interfaces/cloudStorageInterface.js +2 -1
  172. package/dist/src/interfaces/coinPurchaseOfferInterface.js +2 -1
  173. package/dist/src/interfaces/columnInterface.js +2 -1
  174. package/dist/src/interfaces/commanInterface.js +2 -1
  175. package/dist/src/interfaces/contactFeedBackInterface.js +2 -1
  176. package/dist/src/interfaces/countryInterface.js +2 -1
  177. package/dist/src/interfaces/courseHasVisitorsInterface.js +2 -1
  178. package/dist/src/interfaces/courseInterface.js +2 -1
  179. package/dist/src/interfaces/dailyBookInterface.js +2 -1
  180. package/dist/src/interfaces/dashboardManagementInterface.js +2 -1
  181. package/dist/src/interfaces/driverInterface.js +2 -1
  182. package/dist/src/interfaces/entityGroupInterface.js +2 -1
  183. package/dist/src/interfaces/eventInterface.js +2 -1
  184. package/dist/src/interfaces/examGroupInterface.js +2 -1
  185. package/dist/src/interfaces/examHasAnswerSheetInterface.js +2 -1
  186. package/dist/src/interfaces/examInterface.js +2 -1
  187. package/dist/src/interfaces/facilityInterface.js +2 -1
  188. package/dist/src/interfaces/featureActionInterface.js +2 -1
  189. package/dist/src/interfaces/feeHistoryDetailsInterface.js +2 -1
  190. package/dist/src/interfaces/feeHistoryInterface.js +2 -1
  191. package/dist/src/interfaces/feeReminderInterface.js +2 -1
  192. package/dist/src/interfaces/feeReminderSettingInterface.js +2 -1
  193. package/dist/src/interfaces/feeReminderTypeInterface.js +2 -1
  194. package/dist/src/interfaces/feeTypeHasTermsInterface.js +2 -1
  195. package/dist/src/interfaces/feeTypeInterface.js +2 -1
  196. package/dist/src/interfaces/feedBackInterface.js +2 -1
  197. package/dist/src/interfaces/feesCollectionInterface.js +2 -1
  198. package/dist/src/interfaces/fileStorageInterface.js +2 -1
  199. package/dist/src/interfaces/floorManagementInterface.js +2 -1
  200. package/dist/src/interfaces/generateIdCardInterface.js +2 -1
  201. package/dist/src/interfaces/greetingsInterface.js +2 -1
  202. package/dist/src/interfaces/holidayInterface.js +2 -1
  203. package/dist/src/interfaces/homeworkInterface.js +2 -1
  204. package/dist/src/interfaces/informationSupportInterface.js +2 -1
  205. package/dist/src/interfaces/inquiryInterface.js +2 -1
  206. package/dist/src/interfaces/instituteEntityInterface.js +2 -1
  207. package/dist/src/interfaces/instituteEntityTypeInterface.js +2 -1
  208. package/dist/src/interfaces/instituteInterface.js +2 -1
  209. package/dist/src/interfaces/instituteSubscriptionPlanInterface.js +2 -1
  210. package/dist/src/interfaces/inventoryHistoryInterface.js +2 -1
  211. package/dist/src/interfaces/inventoryInterface.js +2 -1
  212. package/dist/src/interfaces/invoiceInterface.js +2 -1
  213. package/dist/src/interfaces/jobApplyInterface.js +2 -1
  214. package/dist/src/interfaces/lectureHistoryInterface.js +2 -1
  215. package/dist/src/interfaces/lectureInterface.js +2 -1
  216. package/dist/src/interfaces/masterLeaveInterface.js +2 -1
  217. package/dist/src/interfaces/moduleFeatureInterface.js +2 -1
  218. package/dist/src/interfaces/moduleInterface.js +2 -1
  219. package/dist/src/interfaces/offersInterface.js +2 -1
  220. package/dist/src/interfaces/paymentTermsInterface.js +2 -1
  221. package/dist/src/interfaces/pdcChequeInterface.js +2 -1
  222. package/dist/src/interfaces/pdcHistoryInterface.js +2 -1
  223. package/dist/src/interfaces/photosGalleryInterface.js +2 -1
  224. package/dist/src/interfaces/pincodeInterface.js +2 -1
  225. package/dist/src/interfaces/plannerInterface.js +2 -1
  226. package/dist/src/interfaces/productInterface.js +2 -1
  227. package/dist/src/interfaces/projectAssessmentOptionInterface.js +2 -1
  228. package/dist/src/interfaces/replaceTeacherInterface.js +2 -1
  229. package/dist/src/interfaces/roleInterface.js +2 -1
  230. package/dist/src/interfaces/rulesRegulationInterface.js +2 -1
  231. package/dist/src/interfaces/schoolFeeCollectionInterface.js +2 -1
  232. package/dist/src/interfaces/schoolFeeInterface.js +2 -1
  233. package/dist/src/interfaces/schoolOfferInterface.js +2 -1
  234. package/dist/src/interfaces/sendNotificationInerface.js +2 -1
  235. package/dist/src/interfaces/slotInterface.js +2 -1
  236. package/dist/src/interfaces/stateInterface.js +2 -1
  237. package/dist/src/interfaces/subCategoriesInterface.js +2 -1
  238. package/dist/src/interfaces/subjectHasFeeInterface.js +2 -1
  239. package/dist/src/interfaces/subjectHasPayFeeHistoryInterface.js +2 -1
  240. package/dist/src/interfaces/subjectIndexInterface.js +2 -1
  241. package/dist/src/interfaces/subscriptionPlanInterface.js +2 -1
  242. package/dist/src/interfaces/syllabusInterface.js +2 -1
  243. package/dist/src/interfaces/taskManagementInterface.js +2 -1
  244. package/dist/src/interfaces/testimonialInterface.js +2 -1
  245. package/dist/src/interfaces/toDoInterface.js +2 -1
  246. package/dist/src/interfaces/tokenInterface.js +2 -1
  247. package/dist/src/interfaces/tripInterface.js +2 -1
  248. package/dist/src/interfaces/typeManagementInterface.js +2 -1
  249. package/dist/src/interfaces/uniqueNumberCounterInterface.js +2 -1
  250. package/dist/src/interfaces/userBookAssessmentInterface.js +2 -1
  251. package/dist/src/interfaces/userDetailsInterface.js +2 -1
  252. package/dist/src/interfaces/userFeeTypeByAccountInterface.js +2 -1
  253. package/dist/src/interfaces/userFeeTypeInterface.js +2 -1
  254. package/dist/src/interfaces/userHasAnnouncementInterface.js +2 -1
  255. package/dist/src/interfaces/userHasBatchInterface.js +2 -1
  256. package/dist/src/interfaces/userHasCourseInterface.js +2 -1
  257. package/dist/src/interfaces/userHasDeviceInterface.js +2 -1
  258. package/dist/src/interfaces/userHasFeeTermsInterface.js +2 -1
  259. package/dist/src/interfaces/userHasFileInterface.js +2 -1
  260. package/dist/src/interfaces/userHasHomeWorkInterface.js +2 -1
  261. package/dist/src/interfaces/userHasInventoryHistoryInterface.js +2 -1
  262. package/dist/src/interfaces/userHasInventoryInterface.js +2 -1
  263. package/dist/src/interfaces/userHasLeaveHistoryInterface.js +2 -1
  264. package/dist/src/interfaces/userHasLeaveInterface.js +2 -1
  265. package/dist/src/interfaces/userHasOfferInterface.js +2 -1
  266. package/dist/src/interfaces/userHasParentInterface.js +2 -1
  267. package/dist/src/interfaces/userHasRoleInterface.js +2 -1
  268. package/dist/src/interfaces/userHasRollNumberInterface.js +2 -1
  269. package/dist/src/interfaces/userHasStorageInterface.js +2 -1
  270. package/dist/src/interfaces/userHasSubjectFeeInterface.js +2 -1
  271. package/dist/src/interfaces/userInstituteMetaInterface.js +2 -1
  272. package/dist/src/interfaces/userInterface.js +2 -1
  273. package/dist/src/interfaces/userLeaveRequestInterface.js +2 -1
  274. package/dist/src/interfaces/userMetaInterface.js +2 -1
  275. package/dist/src/interfaces/userPayoutDetailsInterface.js +2 -1
  276. package/dist/src/interfaces/userPayoutHistoryInterface.js +2 -1
  277. package/dist/src/interfaces/userPayoutInterface.js +2 -1
  278. package/dist/src/interfaces/userProjectAssessmentOptionInterface.js +2 -1
  279. package/dist/src/interfaces/userRequiredStepsInterface.js +2 -1
  280. package/dist/src/interfaces/userSchoolMetaInterface.js +2 -1
  281. package/dist/src/interfaces/vehicleInterface.js +2 -1
  282. package/dist/src/interfaces/vendorManagementInterface.js +2 -1
  283. package/dist/src/interfaces/videoAnalystInterface.js +2 -1
  284. package/dist/src/interfaces/walletHistoryInterface.js +2 -1
  285. package/dist/src/interfaces/walletInterface.js +2 -1
  286. package/dist/src/interfaces/walletTransactionInterface.js +2 -1
  287. package/dist/src/interfaces/workingDayInterface.js +2 -1
  288. package/dist/src/interfaces/workingShiftInterface.js +2 -1
  289. package/dist/src/models/mongodb/approvalRequestModel.js +43 -8
  290. package/dist/src/models/mongodb/attendanceModel.js +68 -30
  291. package/dist/src/models/mongodb/blogModel.js +46 -11
  292. package/dist/src/models/mongodb/careerModel.js +42 -7
  293. package/dist/src/models/mongodb/certificatesHistoryModel.js +39 -4
  294. package/dist/src/models/mongodb/certificatesManagementModel.js +42 -7
  295. package/dist/src/models/mongodb/columnModel.js +45 -10
  296. package/dist/src/models/mongodb/dailyBookModel.js +39 -4
  297. package/dist/src/models/mongodb/dashboardManagementModel.js +46 -11
  298. package/dist/src/models/mongodb/eventModel.js +58 -20
  299. package/dist/src/models/mongodb/examGroupModel.js +69 -31
  300. package/dist/src/models/mongodb/examHasAnswerSheetModel.js +56 -18
  301. package/dist/src/models/mongodb/examModel.js +76 -38
  302. package/dist/src/models/mongodb/feeReminderTypeModel.js +42 -7
  303. package/dist/src/models/mongodb/feedBackModel.js +43 -8
  304. package/dist/src/models/mongodb/generateIdCardModel.js +39 -4
  305. package/dist/src/models/mongodb/holidayModel.js +58 -20
  306. package/dist/src/models/mongodb/index.js +16 -11
  307. package/dist/src/models/mongodb/informationSupportModel.js +42 -7
  308. package/dist/src/models/mongodb/inquiryModel.js +67 -29
  309. package/dist/src/models/mongodb/invoiceModel.js +48 -13
  310. package/dist/src/models/mongodb/jobApplyModel.js +49 -14
  311. package/dist/src/models/mongodb/photosGalleryModel.js +46 -11
  312. package/dist/src/models/mongodb/plannerModel.js +45 -10
  313. package/dist/src/models/mongodb/plugin/addDefaultAttributesPlugin.js +4 -1
  314. package/dist/src/models/mongodb/plugin/transformIdInQueryPlugin.js +3 -1
  315. package/dist/src/models/mongodb/plugin/transformIdInResponsePlugin.js +8 -3
  316. package/dist/src/models/mongodb/replaceTeacherModel.js +46 -11
  317. package/dist/src/models/mongodb/schoolFeeModel.js +56 -18
  318. package/dist/src/models/mongodb/subjectIndexModel.js +152 -114
  319. package/dist/src/models/mongodb/subscriptionPlanModel.js +49 -14
  320. package/dist/src/models/mongodb/taskManagementModel.js +58 -20
  321. package/dist/src/models/mongodb/uniqueNumberCounterModel.js +42 -7
  322. package/dist/src/models/mongodb/userDetailsModel.js +68 -32
  323. package/dist/src/models/mongodb/userDoc.js +6 -3
  324. package/dist/src/models/mongodb/userInstituteMetaModel.js +54 -19
  325. package/dist/src/models/mongodb/userSchoolMetaModel.js +46 -41
  326. package/dist/src/models/mongodb/videoAnalystModel.js +40 -5
  327. package/dist/src/models/mongodb/walletTransactionModel.js +56 -21
  328. package/dist/src/models/psql/SubCategoriesModel.js +28 -23
  329. package/dist/src/models/psql/academicCalendarModel.js +26 -21
  330. package/dist/src/models/psql/accountHasReceiptDetailsModel.js +38 -33
  331. package/dist/src/models/psql/announcementModel.js +58 -53
  332. package/dist/src/models/psql/areaModel.js +17 -12
  333. package/dist/src/models/psql/bankAccountDetailsModel.js +35 -30
  334. package/dist/src/models/psql/bannerModel.js +40 -35
  335. package/dist/src/models/psql/batchModel.js +53 -48
  336. package/dist/src/models/psql/batchSubjectBookAssessmentModel.js +35 -30
  337. package/dist/src/models/psql/batchSubjectProjectAssessmentModel.js +35 -30
  338. package/dist/src/models/psql/bookAssessmentDateModel.js +25 -20
  339. package/dist/src/models/psql/categoriesModel.js +24 -19
  340. package/dist/src/models/psql/cityModel.js +21 -16
  341. package/dist/src/models/psql/classRoomModel.js +36 -31
  342. package/dist/src/models/psql/cloudStorageModel.js +30 -25
  343. package/dist/src/models/psql/coinPurchaseOfferModel.js +31 -26
  344. package/dist/src/models/psql/contactFeedBackModel.js +34 -29
  345. package/dist/src/models/psql/countryModel.js +13 -11
  346. package/dist/src/models/psql/courseHasVisitorsModel.js +22 -17
  347. package/dist/src/models/psql/courseModel.js +41 -36
  348. package/dist/src/models/psql/driverModel.js +51 -46
  349. package/dist/src/models/psql/entityGroupModel.js +29 -24
  350. package/dist/src/models/psql/facilityModel.js +34 -29
  351. package/dist/src/models/psql/featureActionModel.js +28 -23
  352. package/dist/src/models/psql/feeHistoryDetailsModel.js +45 -40
  353. package/dist/src/models/psql/feeHistoryModel.js +78 -73
  354. package/dist/src/models/psql/feeReminderModel.js +63 -58
  355. package/dist/src/models/psql/feeReminderSettingModel.js +27 -22
  356. package/dist/src/models/psql/feeTypeHasTermsModel.js +31 -26
  357. package/dist/src/models/psql/feeTypeModel.js +42 -37
  358. package/dist/src/models/psql/feesCollectionModel.js +55 -50
  359. package/dist/src/models/psql/fileStorageModel.js +26 -21
  360. package/dist/src/models/psql/floorManagementModel.js +25 -20
  361. package/dist/src/models/psql/greetingsModel.js +34 -29
  362. package/dist/src/models/psql/homeWorkModel.js +36 -31
  363. package/dist/src/models/psql/index.js +48 -7
  364. package/dist/src/models/psql/instituteEntityModel.js +34 -29
  365. package/dist/src/models/psql/instituteEntityTypeModel.js +25 -20
  366. package/dist/src/models/psql/instituteModel.js +70 -65
  367. package/dist/src/models/psql/instituteSubscriptionPlanModel.js +42 -37
  368. package/dist/src/models/psql/inventoryHistoryModel.js +42 -37
  369. package/dist/src/models/psql/inventoryModel.js +36 -31
  370. package/dist/src/models/psql/lectureHistoryModel.js +62 -57
  371. package/dist/src/models/psql/lectureModel.js +117 -112
  372. package/dist/src/models/psql/masterLeaveModel.js +41 -36
  373. package/dist/src/models/psql/moduleFeatureModel.js +29 -24
  374. package/dist/src/models/psql/moduleModel.js +30 -25
  375. package/dist/src/models/psql/offerModel.js +39 -34
  376. package/dist/src/models/psql/paymentTermsModel.js +35 -30
  377. package/dist/src/models/psql/pdcChequeModel.js +40 -35
  378. package/dist/src/models/psql/pdcHistoryModel.js +44 -39
  379. package/dist/src/models/psql/pincodeModel.js +28 -23
  380. package/dist/src/models/psql/productModel.js +32 -27
  381. package/dist/src/models/psql/projectAssessmentOptionModel.js +23 -18
  382. package/dist/src/models/psql/roleModel.js +26 -21
  383. package/dist/src/models/psql/rulesRegulationModel.js +23 -18
  384. package/dist/src/models/psql/schoolFeeCollectionModel.js +34 -29
  385. package/dist/src/models/psql/schoolOfferModel.js +43 -38
  386. package/dist/src/models/psql/sendNotificationModel.js +32 -27
  387. package/dist/src/models/psql/slotModel.js +27 -22
  388. package/dist/src/models/psql/stateModel.js +18 -13
  389. package/dist/src/models/psql/subjectHasFeeModel.js +25 -20
  390. package/dist/src/models/psql/subjectHasPayFeeHistoryModel.js +32 -27
  391. package/dist/src/models/psql/syllabusModel.js +31 -26
  392. package/dist/src/models/psql/testimonialModel.js +52 -47
  393. package/dist/src/models/psql/toDoModel.js +35 -30
  394. package/dist/src/models/psql/tokenModel.js +12 -10
  395. package/dist/src/models/psql/tripModel.js +34 -29
  396. package/dist/src/models/psql/typeManagementModel.js +32 -27
  397. package/dist/src/models/psql/userBookAssessmentModel.js +34 -29
  398. package/dist/src/models/psql/userFeeTypeByAccountModel.js +41 -36
  399. package/dist/src/models/psql/userFeeTypeModel.js +44 -39
  400. package/dist/src/models/psql/userHasAnnouncementModel.js +31 -26
  401. package/dist/src/models/psql/userHasBatchModel.js +24 -19
  402. package/dist/src/models/psql/userHasCourseModel.js +35 -30
  403. package/dist/src/models/psql/userHasDeviceModel.js +26 -21
  404. package/dist/src/models/psql/userHasFeeTermsModel.js +45 -40
  405. package/dist/src/models/psql/userHasFileModel.js +29 -24
  406. package/dist/src/models/psql/userHasHomeWorkModel.js +36 -31
  407. package/dist/src/models/psql/userHasInventoryHistoryModel.js +41 -36
  408. package/dist/src/models/psql/userHasInventoryModel.js +45 -40
  409. package/dist/src/models/psql/userHasLeaveHistoryModel.js +41 -36
  410. package/dist/src/models/psql/userHasLeaveModel.js +34 -29
  411. package/dist/src/models/psql/userHasOfferModel.js +36 -31
  412. package/dist/src/models/psql/userHasParentModel.js +31 -26
  413. package/dist/src/models/psql/userHasRoleModel.js +27 -22
  414. package/dist/src/models/psql/userHasRollNumberModel.js +28 -23
  415. package/dist/src/models/psql/userHasStorageModel.js +27 -22
  416. package/dist/src/models/psql/userHasSubjectFeeModel.js +27 -22
  417. package/dist/src/models/psql/userLeaveRequestModel.js +43 -38
  418. package/dist/src/models/psql/userModel.js +94 -89
  419. package/dist/src/models/psql/userPayoutDetailsModel.js +41 -36
  420. package/dist/src/models/psql/userPayoutHistoryModel.js +40 -35
  421. package/dist/src/models/psql/userPayoutModel.js +63 -58
  422. package/dist/src/models/psql/userProjectAssessmentOptionModel.js +31 -26
  423. package/dist/src/models/psql/userRequiredStepsModel.js +22 -17
  424. package/dist/src/models/psql/vehicleModel.js +30 -25
  425. package/dist/src/models/psql/vendorManagementModel.js +44 -39
  426. package/dist/src/models/psql/walletHistoryModel.js +34 -28
  427. package/dist/src/models/psql/walletModel.js +25 -20
  428. package/dist/src/models/psql/workingDayModel.js +24 -19
  429. package/dist/src/models/psql/workingShiftModel.js +34 -29
  430. package/dist/src/services/Concrete/mongooseCommonService.js +9 -5
  431. package/dist/src/services/Concrete/sequelizeCommanService.js +9 -6
  432. package/dist/src/services/Contracts/IMongooseCommonService.js +2 -1
  433. package/dist/src/services/Contracts/ISequelizeCommonService.js +2 -1
  434. package/dist/src/types/academicCalendarType.js +2 -1
  435. package/dist/src/types/accountHasReceiptDetailsType.js +2 -1
  436. package/dist/src/types/announcementType.js +2 -1
  437. package/dist/src/types/approveRequestType.js +2 -1
  438. package/dist/src/types/areaType.js +2 -1
  439. package/dist/src/types/attendanceType.js +2 -1
  440. package/dist/src/types/bankAccountDetailsType.js +2 -1
  441. package/dist/src/types/bannerType.js +2 -1
  442. package/dist/src/types/batchSubjectBookAssessmentType.js +2 -1
  443. package/dist/src/types/batchSubjectProjectAssessmentType.js +2 -1
  444. package/dist/src/types/batchType.js +2 -1
  445. package/dist/src/types/blogType.js +2 -1
  446. package/dist/src/types/bookAssessmentDateType.js +2 -1
  447. package/dist/src/types/careerType.js +2 -1
  448. package/dist/src/types/categoriesType.js +2 -1
  449. package/dist/src/types/certificatesHistoryType.js +2 -1
  450. package/dist/src/types/certificatesManagementType.js +2 -1
  451. package/dist/src/types/classRoomType.js +2 -1
  452. package/dist/src/types/cloudStorageType.js +2 -1
  453. package/dist/src/types/coinPurchaseOfferType.js +2 -1
  454. package/dist/src/types/commonType.js +2 -1
  455. package/dist/src/types/contactFeedBackType.js +2 -1
  456. package/dist/src/types/courseHasVisitorsType.js +2 -1
  457. package/dist/src/types/courseType.js +2 -1
  458. package/dist/src/types/dailyBookType.js +2 -1
  459. package/dist/src/types/dashboardManagementType.js +2 -1
  460. package/dist/src/types/driverType.js +2 -1
  461. package/dist/src/types/entityGroupType.js +2 -1
  462. package/dist/src/types/eventType.js +2 -1
  463. package/dist/src/types/examGroupType.js +2 -1
  464. package/dist/src/types/examHasAnswerSheetType.js +2 -1
  465. package/dist/src/types/examType.js +2 -1
  466. package/dist/src/types/facilityType.js +2 -1
  467. package/dist/src/types/featureActionType.js +2 -1
  468. package/dist/src/types/feeHistoryDetailsType.js +2 -1
  469. package/dist/src/types/feeHistoryType.js +2 -1
  470. package/dist/src/types/feeReminderSettingType.js +2 -1
  471. package/dist/src/types/feeReminderType.js +2 -1
  472. package/dist/src/types/feeReminderTypeType.js +2 -1
  473. package/dist/src/types/feeTypeHasTermsType.js +2 -1
  474. package/dist/src/types/feeTypeType.js +2 -1
  475. package/dist/src/types/feedBackType.js +2 -1
  476. package/dist/src/types/feesCollectionType.js +2 -1
  477. package/dist/src/types/fileStorageType.js +2 -1
  478. package/dist/src/types/floormanagementType.js +2 -1
  479. package/dist/src/types/generateIdCardType.js +2 -1
  480. package/dist/src/types/greetingsType.js +2 -1
  481. package/dist/src/types/holidayType.js +2 -1
  482. package/dist/src/types/homeWorkType.js +2 -1
  483. package/dist/src/types/informationSupportType.js +2 -1
  484. package/dist/src/types/inquiryType.js +2 -1
  485. package/dist/src/types/instituteEntityType.js +2 -1
  486. package/dist/src/types/instituteEntityTypeType.js +2 -1
  487. package/dist/src/types/instituteSubscriptionPlanType.js +2 -1
  488. package/dist/src/types/instituteType.js +2 -1
  489. package/dist/src/types/inventoryHistoryType.js +2 -1
  490. package/dist/src/types/inventoryType.js +2 -1
  491. package/dist/src/types/jobApply.js +2 -1
  492. package/dist/src/types/lectureHistoryType.js +2 -1
  493. package/dist/src/types/lectureType.js +2 -1
  494. package/dist/src/types/masterLeaveType.js +2 -1
  495. package/dist/src/types/moduleFeatureType.js +2 -1
  496. package/dist/src/types/moduleType.js +2 -1
  497. package/dist/src/types/offerType.js +2 -1
  498. package/dist/src/types/paymentTermsType.js +2 -1
  499. package/dist/src/types/pdcChequeType.js +2 -1
  500. package/dist/src/types/pdcHistoryType.js +2 -1
  501. package/dist/src/types/photosGalleryType.js +2 -1
  502. package/dist/src/types/plannerType.js +2 -1
  503. package/dist/src/types/productType.js +2 -1
  504. package/dist/src/types/projectAssessmentOptionType.js +2 -1
  505. package/dist/src/types/roleType.js +2 -1
  506. package/dist/src/types/rulesRegulationType.js +2 -1
  507. package/dist/src/types/schoolFeeCollectionType.js +2 -1
  508. package/dist/src/types/schoolFeeType.js +2 -1
  509. package/dist/src/types/schoolOfferType.js +2 -1
  510. package/dist/src/types/sendNotificationType.js +2 -1
  511. package/dist/src/types/slotType.js +2 -1
  512. package/dist/src/types/subCategoryType.js +2 -1
  513. package/dist/src/types/subjectHasFeeType.js +2 -1
  514. package/dist/src/types/subjectHasPayFeeHistoryType.js +2 -1
  515. package/dist/src/types/subjectIndexType.js +2 -1
  516. package/dist/src/types/subscriptionPlanType.js +2 -1
  517. package/dist/src/types/syllabusType.js +2 -1
  518. package/dist/src/types/taskManagementType.js +2 -1
  519. package/dist/src/types/testimonialType.js +2 -1
  520. package/dist/src/types/toDoType.js +2 -1
  521. package/dist/src/types/tripType.js +2 -1
  522. package/dist/src/types/typeManagementType.js +2 -1
  523. package/dist/src/types/uniqueNumberCounterType.js +2 -1
  524. package/dist/src/types/userBookAssessmentType.js +2 -1
  525. package/dist/src/types/userDetailsType.js +2 -1
  526. package/dist/src/types/userFeeTypeByAccountType.js +2 -1
  527. package/dist/src/types/userFeeTypeType.js +2 -1
  528. package/dist/src/types/userHasAnnouncementType.js +2 -1
  529. package/dist/src/types/userHasBatchType.js +2 -1
  530. package/dist/src/types/userHasCourseType.js +2 -1
  531. package/dist/src/types/userHasDeviceType.js +2 -1
  532. package/dist/src/types/userHasFeeTermsType.js +2 -1
  533. package/dist/src/types/userHasFileType.js +2 -1
  534. package/dist/src/types/userHasHomeWorkType.js +2 -1
  535. package/dist/src/types/userHasInventoryHistoryType.js +2 -1
  536. package/dist/src/types/userHasInventoryType.js +2 -1
  537. package/dist/src/types/userHasLeaveHistoryType.js +2 -1
  538. package/dist/src/types/userHasLeaveType.js +2 -1
  539. package/dist/src/types/userHasOffer.js +2 -1
  540. package/dist/src/types/userHasParentType.js +2 -1
  541. package/dist/src/types/userHasRoleType.js +2 -1
  542. package/dist/src/types/userHasRollNumberType.js +2 -1
  543. package/dist/src/types/userHasStorageType.js +2 -1
  544. package/dist/src/types/userHasSubjectFeeType.js +2 -1
  545. package/dist/src/types/userInstituteMetaType.js +2 -1
  546. package/dist/src/types/userLeaveRequestType.js +2 -1
  547. package/dist/src/types/userMetaType.js +2 -1
  548. package/dist/src/types/userPayoutDetailsType.js +2 -1
  549. package/dist/src/types/userPayoutHistoryType.js +2 -1
  550. package/dist/src/types/userPayoutType.js +2 -1
  551. package/dist/src/types/userProjectAssessmentOptionType.js +2 -1
  552. package/dist/src/types/userRequiredStepsType.js +2 -1
  553. package/dist/src/types/userSchoolMetaType.js +2 -1
  554. package/dist/src/types/userType.js +2 -1
  555. package/dist/src/types/vehicleType.js +2 -1
  556. package/dist/src/types/vendorType.js +2 -1
  557. package/dist/src/types/videoAnalystType.js +2 -1
  558. package/dist/src/types/walletHistoryType.js +2 -1
  559. package/dist/src/types/walletTransactionType.js +2 -1
  560. package/dist/src/types/walletType.js +2 -1
  561. package/dist/src/types/workingDayType.js +2 -1
  562. package/dist/src/types/workingShiftType.js +2 -1
  563. package/package.json +1 -1
@@ -1,30 +1,68 @@
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 });
1
39
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import mongoose, { Schema, } from "mongoose";
3
- import { CHAPTER_INDEX_FILE_TYPE, CHAPTER_INDEX_TYPE, COMMAN_STATUS, INSTITUTE_ENTITY_TYPE_SEQUENCE, SUBJECT_INDEX_TYPE, USER_CHAPTER_INDEX_STATUS, USER_INSTITUTE_META_STATUS, USER_TYPES, } from "../../constants/app.js";
4
- import { v4 as uuidv4 } from "uuid";
5
- import { buildNestedStructure, getUniqueArrayByFields, isValidUUID, keyByFieldOrFields, startOfDay, } from "../../helpers/utils.js";
6
- import { Op } from "sequelize";
7
- import { ENV_VARIABLE } from "../../configs/env.js";
8
- import { INSTITUTE_ERROR_MESSAGES, INSTITUTE_ENTITY_ERROR_MESSAGES, BATCH_ERROR_MESSAGES, USER_ERROR_MESSAGES, SUBJECT_INDEX_ERROR_MESSAGES, } from "../../constants/errorMessages.js";
9
- import BatchModel from "../psql/batchModel.js";
10
- import InstituteModel from "../psql/instituteModel.js";
11
- import UserModel from "../psql/userModel.js";
12
- import { DEFAULT_EXCLUDES_ATTRIBUTES, INSTITUTE_BASIC_DETAIL, USER_BASIC_DETAIL, } from "../../constants/defaultModelAttributes.js";
13
- import InstituteEntityModel from "../psql/instituteEntityModel.js";
14
- import FileStorageModel from "../psql/fileStorageModel.js";
15
- import TypeManagementModel from "../psql/typeManagementModel.js";
16
- import LectureModel from "../psql/lectureModel.js";
17
- import { getPresignedUrl } from "../../helpers/s3Uploader.js";
18
- import UserInstituteMeta from "./userInstituteMetaModel.js";
40
+ const mongoose_1 = __importStar(require("mongoose"));
41
+ const app_js_1 = require("../../constants/app.js");
42
+ const uuid_1 = require("uuid");
43
+ const utils_js_1 = require("../../helpers/utils.js");
44
+ const sequelize_1 = require("sequelize");
45
+ const env_js_1 = require("../../configs/env.js");
46
+ const errorMessages_js_1 = require("../../constants/errorMessages.js");
47
+ const batchModel_js_1 = __importDefault(require("../psql/batchModel.js"));
48
+ const instituteModel_js_1 = __importDefault(require("../psql/instituteModel.js"));
49
+ const userModel_js_1 = __importDefault(require("../psql/userModel.js"));
50
+ const defaultModelAttributes_js_1 = require("../../constants/defaultModelAttributes.js");
51
+ const instituteEntityModel_js_1 = __importDefault(require("../psql/instituteEntityModel.js"));
52
+ const fileStorageModel_js_1 = __importDefault(require("../psql/fileStorageModel.js"));
53
+ const typeManagementModel_js_1 = __importDefault(require("../psql/typeManagementModel.js"));
54
+ const lectureModel_js_1 = __importDefault(require("../psql/lectureModel.js"));
55
+ const s3Uploader_js_1 = require("../../helpers/s3Uploader.js");
56
+ const userInstituteMetaModel_js_1 = __importDefault(require("./userInstituteMetaModel.js"));
19
57
  // Define the schema for IChapterFileAttributes
20
- const ChapterFileSchema = new Schema({
58
+ const ChapterFileSchema = new mongoose_1.Schema({
21
59
  id: {
22
60
  type: String,
23
61
  required: true,
24
62
  },
25
63
  type: {
26
64
  type: String,
27
- enum: Object.values(CHAPTER_INDEX_FILE_TYPE),
65
+ enum: Object.values(app_js_1.CHAPTER_INDEX_FILE_TYPE),
28
66
  required: true,
29
67
  },
30
68
  fileStorageId: {
@@ -53,7 +91,7 @@ const ChapterFileSchema = new Schema({
53
91
  },
54
92
  }, { _id: false } // Prevents automatic _id generation for subdocuments
55
93
  );
56
- const assignedUsersSchema = new Schema({
94
+ const assignedUsersSchema = new mongoose_1.Schema({
57
95
  userId: {
58
96
  type: String,
59
97
  required: true,
@@ -64,8 +102,8 @@ const assignedUsersSchema = new Schema({
64
102
  },
65
103
  status: {
66
104
  type: String,
67
- enum: Object.values(USER_CHAPTER_INDEX_STATUS),
68
- default: USER_CHAPTER_INDEX_STATUS.NOT_COMPLETED,
105
+ enum: Object.values(app_js_1.USER_CHAPTER_INDEX_STATUS),
106
+ default: app_js_1.USER_CHAPTER_INDEX_STATUS.NOT_COMPLETED,
69
107
  required: false,
70
108
  },
71
109
  statusUpdatedAt: {
@@ -89,7 +127,7 @@ const assignedUsersSchema = new Schema({
89
127
  }, { _id: false } // Prevents automatic _id generation for sub documents
90
128
  );
91
129
  // Define the schema for IChapterIndexAttributes
92
- const ChapterIndexSchema = new Schema({
130
+ const ChapterIndexSchema = new mongoose_1.Schema({
93
131
  id: {
94
132
  type: String,
95
133
  required: true,
@@ -108,7 +146,7 @@ const ChapterIndexSchema = new Schema({
108
146
  },
109
147
  type: {
110
148
  type: String,
111
- enum: Object.values(CHAPTER_INDEX_TYPE),
149
+ enum: Object.values(app_js_1.CHAPTER_INDEX_TYPE),
112
150
  required: true,
113
151
  },
114
152
  parentId: {
@@ -130,7 +168,7 @@ const ChapterIndexSchema = new Schema({
130
168
  }, { _id: false } // Prevents automatic _id generation for subdocuments
131
169
  );
132
170
  // Define the schema for ISubjectIndexModelAttributes
133
- const SubjectIndexSchema = new Schema({
171
+ const SubjectIndexSchema = new mongoose_1.Schema({
134
172
  title: {
135
173
  type: String,
136
174
  required: false,
@@ -145,7 +183,7 @@ const SubjectIndexSchema = new Schema({
145
183
  },
146
184
  type: {
147
185
  type: String,
148
- enum: Object.values(SUBJECT_INDEX_TYPE),
186
+ enum: Object.values(app_js_1.SUBJECT_INDEX_TYPE),
149
187
  required: true,
150
188
  },
151
189
  chapterIndex: {
@@ -154,8 +192,8 @@ const SubjectIndexSchema = new Schema({
154
192
  },
155
193
  status: {
156
194
  type: String,
157
- enum: Object.values(COMMAN_STATUS),
158
- default: COMMAN_STATUS.ACTIVE,
195
+ enum: Object.values(app_js_1.COMMAN_STATUS),
196
+ default: app_js_1.COMMAN_STATUS.ACTIVE,
159
197
  required: false,
160
198
  },
161
199
  instituteId: {
@@ -193,65 +231,65 @@ const SubjectIndexSchema = new Schema({
193
231
  const creatOrUpdateHook = async (subjectIndex) => {
194
232
  try {
195
233
  if (subjectIndex.instituteId) {
196
- const institute = await InstituteModel.findByPk(subjectIndex.instituteId);
234
+ const institute = await instituteModel_js_1.default.findByPk(subjectIndex.instituteId);
197
235
  if (!institute)
198
- throw new Error(INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
236
+ throw new Error(errorMessages_js_1.INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
199
237
  }
200
238
  if (subjectIndex.sharedInstituteId?.length) {
201
239
  subjectIndex.sharedInstituteId = [
202
240
  ...new Set(subjectIndex.sharedInstituteId),
203
241
  ];
204
- const count = await InstituteModel.count({
242
+ const count = await instituteModel_js_1.default.count({
205
243
  where: {
206
- id: { [Op.in]: subjectIndex.sharedInstituteId },
244
+ id: { [sequelize_1.Op.in]: subjectIndex.sharedInstituteId },
207
245
  },
208
246
  });
209
247
  if (count !== subjectIndex.sharedInstituteId.length)
210
- throw new Error(INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
248
+ throw new Error(errorMessages_js_1.INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
211
249
  }
212
250
  if (subjectIndex.sharedUnverifiedInstituteId?.length) {
213
251
  subjectIndex.sharedUnverifiedInstituteId = [
214
252
  ...new Set(subjectIndex.sharedUnverifiedInstituteId),
215
253
  ].filter((instituteId) => !subjectIndex?.sharedInstituteId?.includes(instituteId));
216
- const count = await InstituteModel.count({
254
+ const count = await instituteModel_js_1.default.count({
217
255
  where: {
218
- id: { [Op.in]: subjectIndex.sharedUnverifiedInstituteId },
256
+ id: { [sequelize_1.Op.in]: subjectIndex.sharedUnverifiedInstituteId },
219
257
  },
220
258
  });
221
259
  if (count !== subjectIndex.sharedUnverifiedInstituteId.length)
222
- throw new Error(INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
260
+ throw new Error(errorMessages_js_1.INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
223
261
  }
224
262
  if (subjectIndex.subject) {
225
- const subject = await InstituteEntityModel.findOne({
263
+ const subject = await instituteEntityModel_js_1.default.findOne({
226
264
  where: { id: subjectIndex.subject },
227
265
  include: [
228
266
  {
229
267
  association: "entityType",
230
- where: { sequence: INSTITUTE_ENTITY_TYPE_SEQUENCE.LAST },
268
+ where: { sequence: app_js_1.INSTITUTE_ENTITY_TYPE_SEQUENCE.LAST },
231
269
  },
232
270
  ],
233
271
  });
234
272
  if (!subject)
235
- throw new Error(INSTITUTE_ENTITY_ERROR_MESSAGES.NOT_FOUND);
273
+ throw new Error(errorMessages_js_1.INSTITUTE_ENTITY_ERROR_MESSAGES.NOT_FOUND);
236
274
  }
237
275
  if (subjectIndex.batch) {
238
- const batch = await BatchModel.findOne({
276
+ const batch = await batchModel_js_1.default.findOne({
239
277
  where: {
240
278
  id: subjectIndex.batch,
241
- subjects: { [Op.overlap]: [subjectIndex.subject] },
279
+ subjects: { [sequelize_1.Op.overlap]: [subjectIndex.subject] },
242
280
  },
243
281
  });
244
282
  if (!batch)
245
- throw new Error(BATCH_ERROR_MESSAGES.NOT_FOUND);
283
+ throw new Error(errorMessages_js_1.BATCH_ERROR_MESSAGES.NOT_FOUND);
246
284
  }
247
285
  if (subjectIndex.userId) {
248
- const userId = await UserModel.findOne({
286
+ const userId = await userModel_js_1.default.findOne({
249
287
  where: {
250
288
  id: subjectIndex.userId,
251
289
  },
252
290
  });
253
291
  if (!userId) {
254
- throw new Error(USER_ERROR_MESSAGES.NOT_FOUND);
292
+ throw new Error(errorMessages_js_1.USER_ERROR_MESSAGES.NOT_FOUND);
255
293
  }
256
294
  }
257
295
  if (subjectIndex.chapterIndex && subjectIndex.chapterIndex.length) {
@@ -278,19 +316,19 @@ const creatOrUpdateHook = async (subjectIndex) => {
278
316
  }
279
317
  return true;
280
318
  };
281
- const chapterList = subjectIndex.chapterIndex.filter((chapter) => chapter.type === CHAPTER_INDEX_TYPE.CHAPTER);
319
+ const chapterList = subjectIndex.chapterIndex.filter((chapter) => chapter.type === app_js_1.CHAPTER_INDEX_TYPE.CHAPTER);
282
320
  if (!isValidIndex(chapterList))
283
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_INDEX);
321
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_INDEX);
284
322
  for (const chapter of chapterList) {
285
- const topicList = subjectIndex.chapterIndex.filter((topic) => topic.type === CHAPTER_INDEX_TYPE.TOPIC &&
323
+ const topicList = subjectIndex.chapterIndex.filter((topic) => topic.type === app_js_1.CHAPTER_INDEX_TYPE.TOPIC &&
286
324
  topic.parentId === chapter.id);
287
325
  if (!isValidIndex(topicList))
288
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
326
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
289
327
  for (const topic of topicList) {
290
- const subTopicList = subjectIndex.chapterIndex.filter((subTopic) => subTopic.type === CHAPTER_INDEX_TYPE.SUB_TOPIC &&
328
+ const subTopicList = subjectIndex.chapterIndex.filter((subTopic) => subTopic.type === app_js_1.CHAPTER_INDEX_TYPE.SUB_TOPIC &&
291
329
  subTopic.parentId === topic.id);
292
330
  if (!isValidIndex(subTopicList))
293
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
331
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
294
332
  const topicIndex = subjectIndex.chapterIndex.findIndex((c) => c.id === topic.id);
295
333
  if (!subTopicList.length && topic.teachingTime) {
296
334
  subjectIndex.chapterIndex[topicIndex].teachingTime =
@@ -313,18 +351,18 @@ const creatOrUpdateHook = async (subjectIndex) => {
313
351
  }
314
352
  for (const chapterIndex of subjectIndex.chapterIndex) {
315
353
  if (!chapterIndex.id)
316
- chapterIndex.id = uuidv4();
317
- if (chapterIndex.type !== CHAPTER_INDEX_TYPE.CHAPTER) {
354
+ chapterIndex.id = (0, uuid_1.v4)();
355
+ if (chapterIndex.type !== app_js_1.CHAPTER_INDEX_TYPE.CHAPTER) {
318
356
  const parentChapterIndex = subjectIndex.chapterIndex.find((index) => index.id === chapterIndex.parentId);
319
357
  if (!parentChapterIndex)
320
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
321
- if (chapterIndex.type === CHAPTER_INDEX_TYPE.SUB_TOPIC &&
322
- parentChapterIndex.type !== CHAPTER_INDEX_TYPE.TOPIC) {
323
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
358
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
359
+ if (chapterIndex.type === app_js_1.CHAPTER_INDEX_TYPE.SUB_TOPIC &&
360
+ parentChapterIndex.type !== app_js_1.CHAPTER_INDEX_TYPE.TOPIC) {
361
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
324
362
  }
325
- if (chapterIndex.type === CHAPTER_INDEX_TYPE.TOPIC &&
326
- parentChapterIndex.type !== CHAPTER_INDEX_TYPE.CHAPTER) {
327
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
363
+ if (chapterIndex.type === app_js_1.CHAPTER_INDEX_TYPE.TOPIC &&
364
+ parentChapterIndex.type !== app_js_1.CHAPTER_INDEX_TYPE.CHAPTER) {
365
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
328
366
  }
329
367
  }
330
368
  if (chapterIndex.files && chapterIndex.files.length) {
@@ -335,14 +373,14 @@ const creatOrUpdateHook = async (subjectIndex) => {
335
373
  // }
336
374
  chapterIndex.files = chapterIndex.files.map((file) => {
337
375
  if (!file.id)
338
- file.id = uuidv4();
376
+ file.id = (0, uuid_1.v4)();
339
377
  return file;
340
378
  });
341
379
  }
342
380
  }
343
381
  }
344
382
  if (subjectIndex.assignedUsers && subjectIndex.assignedUsers.length) {
345
- subjectIndex.assignedUsers = getUniqueArrayByFields(subjectIndex.assignedUsers, ["userId", "chapterIndexId"]);
383
+ subjectIndex.assignedUsers = (0, utils_js_1.getUniqueArrayByFields)(subjectIndex.assignedUsers, ["userId", "chapterIndexId"]);
346
384
  const chapterIndex = [...(subjectIndex.chapterIndex || [])];
347
385
  const chapterIndexIdList = chapterIndex
348
386
  // .filter(chapter => chapter.type === CHAPTER_INDEX_TYPE.CHAPTER)
@@ -360,19 +398,19 @@ const creatOrUpdateHook = async (subjectIndex) => {
360
398
  chapter.teachingTime = found.teachingTime;
361
399
  return chapter;
362
400
  });
363
- const chapterList = chapterIndexList.filter((chapter) => chapter.type === CHAPTER_INDEX_TYPE.CHAPTER);
401
+ const chapterList = chapterIndexList.filter((chapter) => chapter.type === app_js_1.CHAPTER_INDEX_TYPE.CHAPTER);
364
402
  if (!chapterList.length)
365
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_INDEX);
403
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_INDEX);
366
404
  for (const chapter of chapterList) {
367
- const topicList = chapterIndexList.filter((topic) => topic.type === CHAPTER_INDEX_TYPE.TOPIC &&
405
+ const topicList = chapterIndexList.filter((topic) => topic.type === app_js_1.CHAPTER_INDEX_TYPE.TOPIC &&
368
406
  topic.parentId === chapter.id);
369
407
  if (!topicList)
370
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
408
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_TOPIC_INDEX);
371
409
  for (const topic of topicList) {
372
- const subTopicList = chapterIndexList.filter((subTopic) => subTopic.type === CHAPTER_INDEX_TYPE.SUB_TOPIC &&
410
+ const subTopicList = chapterIndexList.filter((subTopic) => subTopic.type === app_js_1.CHAPTER_INDEX_TYPE.SUB_TOPIC &&
373
411
  subTopic.parentId === topic.id);
374
412
  if (!subTopicList)
375
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
413
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.INVALID_CHAPTER_SUB_TOPIC_INDEX);
376
414
  const topicIndex = chapterIndexList.findIndex((c) => c.id === topic.id);
377
415
  if (!subTopicList.length && topic.teachingTime) {
378
416
  chapterIndexList[topicIndex].teachingTime = topic.teachingTime;
@@ -399,23 +437,23 @@ const creatOrUpdateHook = async (subjectIndex) => {
399
437
  ];
400
438
  let userIdList = subjectIndex.assignedUsers.map((assignedUser) => assignedUser.userId);
401
439
  userIdList = [...new Set(userIdList)];
402
- const assignedUsersIdCount = await UserModel.count({
440
+ const assignedUsersIdCount = await userModel_js_1.default.count({
403
441
  where: {
404
442
  id: {
405
- [Op.in]: userIdList,
443
+ [sequelize_1.Op.in]: userIdList,
406
444
  },
407
- type: USER_TYPES.TEACHER,
445
+ type: app_js_1.USER_TYPES.TEACHER,
408
446
  },
409
447
  });
410
448
  if (assignedUsersIdCount !== userIdList.length) {
411
- throw new Error(USER_ERROR_MESSAGES.NOT_FOUND);
449
+ throw new Error(errorMessages_js_1.USER_ERROR_MESSAGES.NOT_FOUND);
412
450
  }
413
451
  const where = {
414
- userType: USER_TYPES.TEACHER,
415
- status: USER_INSTITUTE_META_STATUS.ACCEPTED,
452
+ userType: app_js_1.USER_TYPES.TEACHER,
453
+ status: app_js_1.USER_INSTITUTE_META_STATUS.ACCEPTED,
416
454
  entities: { $in: [subjectIndex.subject] },
417
455
  };
418
- if (subjectIndex.type === SUBJECT_INDEX_TYPE.PRIVATE) {
456
+ if (subjectIndex.type === app_js_1.SUBJECT_INDEX_TYPE.PRIVATE) {
419
457
  where.instituteId = {
420
458
  $in: [
421
459
  ...subjectIndex.sharedInstituteId,
@@ -426,15 +464,15 @@ const creatOrUpdateHook = async (subjectIndex) => {
426
464
  else {
427
465
  where.instituteId = subjectIndex.instituteId;
428
466
  }
429
- const userIntituteMetaList = await UserInstituteMeta.find({ ...where }, { userId: 1 });
467
+ const userIntituteMetaList = await userInstituteMetaModel_js_1.default.find({ ...where }, { userId: 1 });
430
468
  let allowUserIds = userIntituteMetaList.map((userIntituteMeta) => userIntituteMeta.userId);
431
- if (subjectIndex.type === SUBJECT_INDEX_TYPE.PRIVATE) {
469
+ if (subjectIndex.type === app_js_1.SUBJECT_INDEX_TYPE.PRIVATE) {
432
470
  allowUserIds.push(subjectIndex.userId);
433
471
  }
434
472
  allowUserIds = [...new Set(allowUserIds)];
435
473
  const notAllowUserIds = subjectIndex.assignedUsers?.filter((assignedUsers) => !allowUserIds.includes(assignedUsers.userId));
436
474
  if (notAllowUserIds?.length)
437
- throw new Error(SUBJECT_INDEX_ERROR_MESSAGES.CAN_NOT_ASSIGN_TO_USER);
475
+ throw new Error(errorMessages_js_1.SUBJECT_INDEX_ERROR_MESSAGES.CAN_NOT_ASSIGN_TO_USER);
438
476
  }
439
477
  }
440
478
  catch (error) {
@@ -442,56 +480,56 @@ const creatOrUpdateHook = async (subjectIndex) => {
442
480
  }
443
481
  };
444
482
  const addDocsDetailsHook = async (subjectIndexList, where = {}, options = {}) => {
445
- const batchList = await BatchModel.findAll({
483
+ const batchList = await batchModel_js_1.default.findAll({
446
484
  where: {
447
485
  id: {
448
- [Op.in]: subjectIndexList.map((subject) => subject.batch),
486
+ [sequelize_1.Op.in]: subjectIndexList.map((subject) => subject.batch),
449
487
  },
450
488
  },
451
489
  });
452
- const batchListById = keyByFieldOrFields(batchList, "id");
453
- const subjectList = await InstituteEntityModel.findAll({
490
+ const batchListById = (0, utils_js_1.keyByFieldOrFields)(batchList, "id");
491
+ const subjectList = await instituteEntityModel_js_1.default.findAll({
454
492
  where: {
455
493
  id: {
456
- [Op.in]: subjectIndexList.map((subject) => subject.subject),
494
+ [sequelize_1.Op.in]: subjectIndexList.map((subject) => subject.subject),
457
495
  },
458
496
  },
459
497
  });
460
- const subjectListById = keyByFieldOrFields(subjectList, "id");
498
+ const subjectListById = (0, utils_js_1.keyByFieldOrFields)(subjectList, "id");
461
499
  const userIdSet = new Set(subjectIndexList.flatMap((subject) => [
462
500
  subject.userId,
463
501
  subject.createdBy,
464
502
  ]));
465
503
  subjectIndexList.forEach((subject) => subject.assignedUsers?.forEach((assign) => userIdSet.add(assign.userId)));
466
- const userList = await UserModel.findAll({
467
- where: { id: { [Op.in]: [...userIdSet] } },
468
- attributes: USER_BASIC_DETAIL,
504
+ const userList = await userModel_js_1.default.findAll({
505
+ where: { id: { [sequelize_1.Op.in]: [...userIdSet] } },
506
+ attributes: defaultModelAttributes_js_1.USER_BASIC_DETAIL,
469
507
  });
470
- const userListById = keyByFieldOrFields(userList, "id");
508
+ const userListById = (0, utils_js_1.keyByFieldOrFields)(userList, "id");
471
509
  const instituteIdSet = new Set(subjectIndexList.flatMap((subject) => [
472
510
  subject.instituteId,
473
511
  ...(subject.sharedInstituteId || []),
474
512
  ]));
475
- const instituteList = await InstituteModel.findAll({
476
- where: { id: { [Op.in]: [...instituteIdSet] } },
477
- attributes: INSTITUTE_BASIC_DETAIL,
513
+ const instituteList = await instituteModel_js_1.default.findAll({
514
+ where: { id: { [sequelize_1.Op.in]: [...instituteIdSet] } },
515
+ attributes: defaultModelAttributes_js_1.INSTITUTE_BASIC_DETAIL,
478
516
  });
479
- const instituteListById = keyByFieldOrFields(instituteList, "id");
517
+ const instituteListById = (0, utils_js_1.keyByFieldOrFields)(instituteList, "id");
480
518
  const fileStorageIdList = subjectIndexList.flatMap((subject) => subject.chapterIndex?.flatMap((chapter) => chapter.files?.map((file) => file.fileStorageId) || []) || []);
481
- const fileStorageList = await FileStorageModel.findAll({
482
- where: { id: { [Op.in]: fileStorageIdList } },
483
- attributes: { exclude: DEFAULT_EXCLUDES_ATTRIBUTES },
519
+ const fileStorageList = await fileStorageModel_js_1.default.findAll({
520
+ where: { id: { [sequelize_1.Op.in]: fileStorageIdList } },
521
+ attributes: { exclude: defaultModelAttributes_js_1.DEFAULT_EXCLUDES_ATTRIBUTES },
484
522
  raw: true,
485
523
  });
486
- const fileStorageListById = keyByFieldOrFields(fileStorageList, "id");
524
+ const fileStorageListById = (0, utils_js_1.keyByFieldOrFields)(fileStorageList, "id");
487
525
  const fileCategoryIdList = subjectIndexList
488
526
  .flatMap((subject) => subject.chapterIndex?.flatMap((chapter) => chapter.files?.map((file) => file.categoryId) || []) || [])
489
- .filter((id) => isValidUUID(id));
490
- const fileCategoryList = await TypeManagementModel.findAll({
491
- where: { id: { [Op.in]: fileCategoryIdList } },
492
- attributes: { exclude: DEFAULT_EXCLUDES_ATTRIBUTES },
527
+ .filter((id) => (0, utils_js_1.isValidUUID)(id));
528
+ const fileCategoryList = await typeManagementModel_js_1.default.findAll({
529
+ where: { id: { [sequelize_1.Op.in]: fileCategoryIdList } },
530
+ attributes: { exclude: defaultModelAttributes_js_1.DEFAULT_EXCLUDES_ATTRIBUTES },
493
531
  });
494
- const fileCategoryListById = keyByFieldOrFields(fileCategoryList, "id");
532
+ const fileCategoryListById = (0, utils_js_1.keyByFieldOrFields)(fileCategoryList, "id");
495
533
  return await Promise.all(
496
534
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
497
535
  subjectIndexList.map(async (subject) => {
@@ -522,20 +560,20 @@ const addDocsDetailsHook = async (subjectIndexList, where = {}, options = {}) =>
522
560
  let completedChapterLastLecture = [];
523
561
  if (subject.assignedUsers &&
524
562
  subject.assignedUsers.length &&
525
- options?.reqUser?.type === USER_TYPES.STUDENT) {
526
- const lectureList = await LectureModel.findAll({
527
- where: { subject: { [Op.in]: [subject.subject] } },
563
+ options?.reqUser?.type === app_js_1.USER_TYPES.STUDENT) {
564
+ const lectureList = await lectureModel_js_1.default.findAll({
565
+ where: { subject: { [sequelize_1.Op.in]: [subject.subject] } },
528
566
  order: [["checkedInAt", "DESC"]],
529
567
  limit: 1,
530
568
  });
531
569
  const lastLecture = lectureList.pop();
532
570
  if (lastLecture) {
533
- const lectureDay = startOfDay(lastLecture.checkedInAt).getTime();
571
+ const lectureDay = (0, utils_js_1.startOfDay)(lastLecture.checkedInAt).getTime();
534
572
  completedChapterLastLecture = subject.assignedUsers
535
573
  .filter((assignedUser) => {
536
- const statusUpdateDay = startOfDay(assignedUser.statusUpdatedAt).getTime();
574
+ const statusUpdateDay = (0, utils_js_1.startOfDay)(assignedUser.statusUpdatedAt).getTime();
537
575
  return (assignedUser?.lectureId === lastLecture.id &&
538
- assignedUser.status === USER_CHAPTER_INDEX_STATUS.COMPLETED &&
576
+ assignedUser.status === app_js_1.USER_CHAPTER_INDEX_STATUS.COMPLETED &&
539
577
  lectureDay === statusUpdateDay);
540
578
  })
541
579
  .map((assignedUser) => assignedUser.chapterIndexId);
@@ -546,12 +584,12 @@ const addDocsDetailsHook = async (subjectIndexList, where = {}, options = {}) =>
546
584
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
547
585
  subject.chapterIndex.map(async (chapter) => {
548
586
  if (chapter.files?.length) {
549
- if (subject.type === SUBJECT_INDEX_TYPE.BATCH &&
587
+ if (subject.type === app_js_1.SUBJECT_INDEX_TYPE.BATCH &&
550
588
  options.reqUser &&
551
589
  [
552
- USER_TYPES.STUDENT,
553
- USER_TYPES.PARENTS,
554
- USER_TYPES.TEACHER,
590
+ app_js_1.USER_TYPES.STUDENT,
591
+ app_js_1.USER_TYPES.PARENTS,
592
+ app_js_1.USER_TYPES.TEACHER,
555
593
  ].includes(options.reqUser.type)) {
556
594
  chapter.files = chapter.files.filter((file) => subject.selectedCategoryIds.includes(file.categoryId));
557
595
  if (!completedChapterLastLecture.includes(chapter.id))
@@ -563,14 +601,14 @@ const addDocsDetailsHook = async (subjectIndexList, where = {}, options = {}) =>
563
601
  file.fileCategoryDetails =
564
602
  fileCategoryListById[file.categoryId] || {};
565
603
  if (file.fileStorageDetails.storageFileName) {
566
- file.fileStorageDetails.filePath = await getPresignedUrl(ENV_VARIABLE.AWS_BUCKET_NAME, file.fileStorageDetails);
604
+ file.fileStorageDetails.filePath = await (0, s3Uploader_js_1.getPresignedUrl)(env_js_1.ENV_VARIABLE.AWS_BUCKET_NAME, file.fileStorageDetails);
567
605
  }
568
606
  return file;
569
607
  }));
570
608
  }
571
609
  return chapter;
572
610
  }));
573
- subject.nestChapterIndex = buildNestedStructure(subject.chapterIndex, "parentId", "list");
611
+ subject.nestChapterIndex = (0, utils_js_1.buildNestedStructure)(subject.chapterIndex, "parentId", "list");
574
612
  }
575
613
  if (subject.assignedUsers?.length) {
576
614
  subject.assignedUsers = subject.assignedUsers.map((assign) => {
@@ -622,8 +660,8 @@ SubjectIndexSchema.index({
622
660
  type: 1,
623
661
  subject: 1,
624
662
  });
625
- const SubjectIndexModel = mongoose.model("subject_indexes", SubjectIndexSchema);
663
+ const SubjectIndexModel = mongoose_1.default.model("subject_indexes", SubjectIndexSchema);
626
664
  // (async () => {
627
665
  // await SubjectIndexModel.syncIndexes();
628
666
  // })(); // Rebuilds indexes in DB based on schema
629
- export default SubjectIndexModel;
667
+ exports.default = SubjectIndexModel;
@@ -1,7 +1,42 @@
1
- import mongoose, { Schema } from 'mongoose';
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { COMMAN_STATUS, SUBSCRIPTION_PLAN_CHARGE_INTERVAL, DISCOUNT_TYPE, VALID_CURRENCY } from '../../constants/app.js';
4
- const subscriptionPlanFilesSchema = new Schema({
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const mongoose_1 = __importStar(require("mongoose"));
37
+ const uuid_1 = require("uuid");
38
+ const app_js_1 = require("../../constants/app.js");
39
+ const subscriptionPlanFilesSchema = new mongoose_1.Schema({
5
40
  type: {
6
41
  type: String,
7
42
  required: true,
@@ -12,15 +47,15 @@ const subscriptionPlanFilesSchema = new Schema({
12
47
  },
13
48
  status: {
14
49
  type: String,
15
- default: COMMAN_STATUS.ACTIVE,
50
+ default: app_js_1.COMMAN_STATUS.ACTIVE,
16
51
  required: true,
17
52
  },
18
53
  }, { _id: false });
19
- const subscriptionPlanModelSchema = new Schema({
54
+ const subscriptionPlanModelSchema = new mongoose_1.Schema({
20
55
  uuid: {
21
56
  type: String,
22
57
  required: true,
23
- default: uuidv4,
58
+ default: uuid_1.v4,
24
59
  },
25
60
  title: {
26
61
  type: String,
@@ -40,7 +75,7 @@ const subscriptionPlanModelSchema = new Schema({
40
75
  },
41
76
  status: {
42
77
  type: String,
43
- default: COMMAN_STATUS.ACTIVE,
78
+ default: app_js_1.COMMAN_STATUS.ACTIVE,
44
79
  required: true,
45
80
  },
46
81
  perUserCharge: {
@@ -53,12 +88,12 @@ const subscriptionPlanModelSchema = new Schema({
53
88
  },
54
89
  chargeInterval: {
55
90
  type: String,
56
- default: SUBSCRIPTION_PLAN_CHARGE_INTERVAL.MONTHLY,
91
+ default: app_js_1.SUBSCRIPTION_PLAN_CHARGE_INTERVAL.MONTHLY,
57
92
  required: true,
58
93
  },
59
94
  discountType: {
60
95
  type: String,
61
- default: DISCOUNT_TYPE.NONE,
96
+ default: app_js_1.DISCOUNT_TYPE.NONE,
62
97
  required: true,
63
98
  },
64
99
  moduleList: {
@@ -68,7 +103,7 @@ const subscriptionPlanModelSchema = new Schema({
68
103
  },
69
104
  validCurrency: {
70
105
  type: String,
71
- default: VALID_CURRENCY.COIN,
106
+ default: app_js_1.VALID_CURRENCY.COIN,
72
107
  required: true,
73
108
  },
74
109
  files: {
@@ -77,7 +112,7 @@ const subscriptionPlanModelSchema = new Schema({
77
112
  required: true,
78
113
  },
79
114
  planHistory: {
80
- type: Schema.Types.Mixed,
115
+ type: mongoose_1.Schema.Types.Mixed,
81
116
  default: [],
82
117
  required: false,
83
118
  },
@@ -94,5 +129,5 @@ const subscriptionPlanModelSchema = new Schema({
94
129
  timestamps: true,
95
130
  versionKey: false,
96
131
  });
97
- const SubscriptionPlanModel = mongoose.model('subscription_plans', subscriptionPlanModelSchema);
98
- export default SubscriptionPlanModel;
132
+ const SubscriptionPlanModel = mongoose_1.default.model('subscription_plans', subscriptionPlanModelSchema);
133
+ exports.default = SubscriptionPlanModel;