@kipicore/dbcore 1.1.32 → 1.1.33

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 (220) hide show
  1. package/dist/models/psql/SubCategoriesModel.d.ts +1 -0
  2. package/dist/models/psql/SubCategoriesModel.js +60 -63
  3. package/dist/models/psql/academicCalendarModel.d.ts +2 -3
  4. package/dist/models/psql/academicCalendarModel.js +45 -42
  5. package/dist/models/psql/accountHasReceiptDetailsModel.d.ts +6 -5
  6. package/dist/models/psql/accountHasReceiptDetailsModel.js +47 -68
  7. package/dist/models/psql/announcementModel.d.ts +10 -8
  8. package/dist/models/psql/announcementModel.js +90 -109
  9. package/dist/models/psql/areaModel.d.ts +5 -1
  10. package/dist/models/psql/areaModel.js +13 -12
  11. package/dist/models/psql/bankAccountDetailsModel.d.ts +6 -5
  12. package/dist/models/psql/bankAccountDetailsModel.js +25 -37
  13. package/dist/models/psql/bannerModel.d.ts +18 -18
  14. package/dist/models/psql/bannerModel.js +53 -81
  15. package/dist/models/psql/batchModel.d.ts +3 -1
  16. package/dist/models/psql/batchModel.js +77 -135
  17. package/dist/models/psql/batchSubjectBookAssessmentModel.d.ts +2 -1
  18. package/dist/models/psql/batchSubjectBookAssessmentModel.js +57 -104
  19. package/dist/models/psql/batchSubjectProjectAssessmentModel.d.ts +2 -1
  20. package/dist/models/psql/batchSubjectProjectAssessmentModel.js +59 -92
  21. package/dist/models/psql/bookAssessmentDateModel.d.ts +2 -1
  22. package/dist/models/psql/bookAssessmentDateModel.js +26 -46
  23. package/dist/models/psql/categoriesModel.d.ts +2 -1
  24. package/dist/models/psql/categoriesModel.js +25 -45
  25. package/dist/models/psql/cityModel.d.ts +2 -1
  26. package/dist/models/psql/cityModel.js +21 -33
  27. package/dist/models/psql/classRoomModel.d.ts +2 -1
  28. package/dist/models/psql/classRoomModel.js +41 -67
  29. package/dist/models/psql/cloudStorageModel.d.ts +2 -1
  30. package/dist/models/psql/cloudStorageModel.js +18 -29
  31. package/dist/models/psql/coinPurchaseOfferModel.d.ts +5 -4
  32. package/dist/models/psql/coinPurchaseOfferModel.js +18 -29
  33. package/dist/models/psql/contactFeedBackModel.d.ts +2 -1
  34. package/dist/models/psql/contactFeedBackModel.js +49 -62
  35. package/dist/models/psql/countryModel.d.ts +1 -1
  36. package/dist/models/psql/countryModel.js +2 -0
  37. package/dist/models/psql/courseHasVisitorsModel.d.ts +2 -1
  38. package/dist/models/psql/courseHasVisitorsModel.js +25 -38
  39. package/dist/models/psql/courseModel.d.ts +2 -1
  40. package/dist/models/psql/courseModel.js +41 -56
  41. package/dist/models/psql/driverModel.d.ts +3 -1
  42. package/dist/models/psql/driverModel.js +61 -65
  43. package/dist/models/psql/entityGroupModel.d.ts +2 -1
  44. package/dist/models/psql/entityGroupModel.js +25 -45
  45. package/dist/models/psql/facilityModel.d.ts +3 -1
  46. package/dist/models/psql/facilityModel.js +63 -73
  47. package/dist/models/psql/featureActionModel.d.ts +3 -2
  48. package/dist/models/psql/featureActionModel.js +21 -36
  49. package/dist/models/psql/feeHistoryDetailsModel.d.ts +2 -1
  50. package/dist/models/psql/feeHistoryDetailsModel.js +65 -106
  51. package/dist/models/psql/feeHistoryModel.d.ts +4 -2
  52. package/dist/models/psql/feeHistoryModel.js +154 -309
  53. package/dist/models/psql/feeReminderModel.d.ts +2 -0
  54. package/dist/models/psql/feeReminderModel.js +147 -179
  55. package/dist/models/psql/feeReminderSettingModel.d.ts +1 -0
  56. package/dist/models/psql/feeReminderSettingModel.js +23 -47
  57. package/dist/models/psql/feeTypeHasTermsModel.d.ts +1 -0
  58. package/dist/models/psql/feeTypeHasTermsModel.js +48 -51
  59. package/dist/models/psql/feeTypeModel.d.ts +1 -0
  60. package/dist/models/psql/feeTypeModel.js +44 -72
  61. package/dist/models/psql/feesCollectionModel.d.ts +2 -0
  62. package/dist/models/psql/feesCollectionModel.js +112 -144
  63. package/dist/models/psql/fileStorageModel.d.ts +1 -0
  64. package/dist/models/psql/fileStorageModel.js +27 -29
  65. package/dist/models/psql/floorManagementModel.d.ts +1 -0
  66. package/dist/models/psql/floorManagementModel.js +23 -42
  67. package/dist/models/psql/greetingsModel.d.ts +3 -2
  68. package/dist/models/psql/greetingsModel.js +64 -66
  69. package/dist/models/psql/homeWorkModel.d.ts +1 -0
  70. package/dist/models/psql/homeWorkModel.js +40 -70
  71. package/dist/models/psql/index.js +6 -3
  72. package/dist/models/psql/instituteEntityModel.d.ts +1 -0
  73. package/dist/models/psql/instituteEntityModel.js +59 -62
  74. package/dist/models/psql/instituteEntityTypeModel.d.ts +1 -0
  75. package/dist/models/psql/instituteEntityTypeModel.js +15 -28
  76. package/dist/models/psql/instituteModel.d.ts +1 -0
  77. package/dist/models/psql/instituteModel.js +66 -185
  78. package/dist/models/psql/instituteSubscriptionPlanModel.d.ts +1 -0
  79. package/dist/models/psql/instituteSubscriptionPlanModel.js +40 -81
  80. package/dist/models/psql/inventoryHistoryModel.d.ts +1 -0
  81. package/dist/models/psql/inventoryHistoryModel.js +39 -79
  82. package/dist/models/psql/inventoryModel.d.ts +1 -0
  83. package/dist/models/psql/inventoryModel.js +31 -62
  84. package/dist/models/psql/lectureHistoryModel.d.ts +1 -0
  85. package/dist/models/psql/lectureHistoryModel.js +65 -196
  86. package/dist/models/psql/lectureModel.d.ts +2 -0
  87. package/dist/models/psql/lectureModel.js +191 -454
  88. package/dist/models/psql/masterLeaveModel.d.ts +2 -0
  89. package/dist/models/psql/masterLeaveModel.js +71 -71
  90. package/dist/models/psql/moduleFeatureModel.d.ts +1 -0
  91. package/dist/models/psql/moduleFeatureModel.js +41 -44
  92. package/dist/models/psql/moduleModel.d.ts +1 -0
  93. package/dist/models/psql/moduleModel.js +48 -52
  94. package/dist/models/psql/offerModel.d.ts +1 -0
  95. package/dist/models/psql/offerModel.js +43 -64
  96. package/dist/models/psql/paymentTermsModel.d.ts +1 -0
  97. package/dist/models/psql/paymentTermsModel.js +43 -45
  98. package/dist/models/psql/pdcChequeModel.d.ts +1 -0
  99. package/dist/models/psql/pdcChequeModel.js +59 -64
  100. package/dist/models/psql/pdcHistoryModel.d.ts +1 -0
  101. package/dist/models/psql/pdcHistoryModel.js +55 -73
  102. package/dist/models/psql/pincodeModel.d.ts +1 -0
  103. package/dist/models/psql/pincodeModel.js +6 -9
  104. package/dist/models/psql/productModel.d.ts +1 -0
  105. package/dist/models/psql/productModel.js +40 -80
  106. package/dist/models/psql/projectAssessmentOptionModel.d.ts +1 -0
  107. package/dist/models/psql/projectAssessmentOptionModel.js +23 -45
  108. package/dist/models/psql/roleModel.d.ts +1 -0
  109. package/dist/models/psql/roleModel.js +15 -38
  110. package/dist/models/psql/rulesRegulationModel.d.ts +3 -2
  111. package/dist/models/psql/rulesRegulationModel.js +20 -33
  112. package/dist/models/psql/schoolFeeCollectionModel.d.ts +1 -0
  113. package/dist/models/psql/schoolFeeCollectionModel.js +47 -94
  114. package/dist/models/psql/schoolOfferModel.d.ts +1 -0
  115. package/dist/models/psql/schoolOfferModel.js +39 -78
  116. package/dist/models/psql/sendNotificationModel.d.ts +1 -0
  117. package/dist/models/psql/sendNotificationModel.js +37 -61
  118. package/dist/models/psql/slotModel.d.ts +2 -0
  119. package/dist/models/psql/slotModel.js +46 -58
  120. package/dist/models/psql/stateModel.d.ts +1 -0
  121. package/dist/models/psql/stateModel.js +17 -18
  122. package/dist/models/psql/subjectHasFeeModel.d.ts +1 -0
  123. package/dist/models/psql/subjectHasFeeModel.js +49 -46
  124. package/dist/models/psql/subjectHasPayFeeHistoryModel.d.ts +1 -0
  125. package/dist/models/psql/subjectHasPayFeeHistoryModel.js +74 -69
  126. package/dist/models/psql/syllabusModel.d.ts +1 -0
  127. package/dist/models/psql/syllabusModel.js +72 -85
  128. package/dist/models/psql/testimonialModel.d.ts +2 -0
  129. package/dist/models/psql/testimonialModel.js +97 -100
  130. package/dist/models/psql/toDoModel.d.ts +2 -0
  131. package/dist/models/psql/toDoModel.js +64 -64
  132. package/dist/models/psql/tripModel.d.ts +1 -0
  133. package/dist/models/psql/tripModel.js +51 -55
  134. package/dist/models/psql/typeManagementModel.d.ts +2 -0
  135. package/dist/models/psql/typeManagementModel.js +69 -69
  136. package/dist/models/psql/userBookAssessmentModel.d.ts +1 -0
  137. package/dist/models/psql/userBookAssessmentModel.js +83 -89
  138. package/dist/models/psql/userFeeTypeByAccountModel.d.ts +1 -0
  139. package/dist/models/psql/userFeeTypeByAccountModel.js +117 -122
  140. package/dist/models/psql/userFeeTypeModel.d.ts +1 -0
  141. package/dist/models/psql/userFeeTypeModel.js +97 -102
  142. package/dist/models/psql/userHasAnnouncementModel.d.ts +1 -0
  143. package/dist/models/psql/userHasAnnouncementModel.js +63 -66
  144. package/dist/models/psql/userHasBatchModel.d.ts +1 -0
  145. package/dist/models/psql/userHasBatchModel.js +55 -57
  146. package/dist/models/psql/userHasCourseModel.d.ts +1 -0
  147. package/dist/models/psql/userHasCourseModel.js +51 -55
  148. package/dist/models/psql/userHasDeviceModel.d.ts +1 -0
  149. package/dist/models/psql/userHasDeviceModel.js +35 -38
  150. package/dist/models/psql/userHasFeeTermsModel.d.ts +1 -0
  151. package/dist/models/psql/userHasFeeTermsModel.js +51 -117
  152. package/dist/models/psql/userHasFileModel.d.ts +1 -0
  153. package/dist/models/psql/userHasFileModel.js +33 -61
  154. package/dist/models/psql/userHasHomeWorkModel.d.ts +9 -6
  155. package/dist/models/psql/userHasHomeWorkModel.js +50 -72
  156. package/dist/models/psql/userHasInventoryHistoryModel.d.ts +5 -4
  157. package/dist/models/psql/userHasInventoryHistoryModel.js +42 -59
  158. package/dist/models/psql/userHasInventoryModel.d.ts +5 -4
  159. package/dist/models/psql/userHasInventoryModel.js +30 -54
  160. package/dist/models/psql/userHasLeaveHistoryModel.d.ts +5 -4
  161. package/dist/models/psql/userHasLeaveHistoryModel.js +21 -36
  162. package/dist/models/psql/userHasLeaveModel.d.ts +6 -5
  163. package/dist/models/psql/userHasLeaveModel.js +47 -68
  164. package/dist/models/psql/userHasOfferModel.d.ts +8 -7
  165. package/dist/models/psql/userHasOfferModel.js +54 -109
  166. package/dist/models/psql/userHasParentModel.d.ts +7 -5
  167. package/dist/models/psql/userHasParentModel.js +38 -65
  168. package/dist/models/psql/userHasRoleModel.d.ts +6 -5
  169. package/dist/models/psql/userHasRoleModel.js +27 -56
  170. package/dist/models/psql/userHasRollNumberModel.d.ts +5 -4
  171. package/dist/models/psql/userHasRollNumberModel.js +39 -54
  172. package/dist/models/psql/userHasStorageModel.d.ts +5 -4
  173. package/dist/models/psql/userHasStorageModel.js +31 -35
  174. package/dist/models/psql/userHasSubjectFeeModel.d.ts +5 -4
  175. package/dist/models/psql/userHasSubjectFeeModel.js +32 -47
  176. package/dist/models/psql/userLeaveRequestModel.d.ts +6 -5
  177. package/dist/models/psql/userLeaveRequestModel.js +24 -40
  178. package/dist/models/psql/userModel.d.ts +2 -2
  179. package/dist/models/psql/userModel.js +174 -370
  180. package/dist/models/psql/userPayoutDetailsModel.d.ts +1 -0
  181. package/dist/models/psql/userPayoutDetailsModel.js +65 -146
  182. package/dist/models/psql/userPayoutHistoryModel.d.ts +1 -0
  183. package/dist/models/psql/userPayoutHistoryModel.js +39 -66
  184. package/dist/models/psql/userPayoutModel.d.ts +2 -0
  185. package/dist/models/psql/userPayoutModel.js +205 -240
  186. package/dist/models/psql/userProjectAssessmentOptionModel.d.ts +1 -0
  187. package/dist/models/psql/userProjectAssessmentOptionModel.js +39 -74
  188. package/dist/models/psql/userRequiredStepsModel.d.ts +1 -0
  189. package/dist/models/psql/userRequiredStepsModel.js +23 -36
  190. package/dist/models/psql/vehicleModel.d.ts +1 -0
  191. package/dist/models/psql/vehicleModel.js +27 -53
  192. package/dist/models/psql/vendorManagementModel.d.ts +6 -5
  193. package/dist/models/psql/vendorManagementModel.js +48 -97
  194. package/dist/models/psql/walletHistoryModel.d.ts +2 -1
  195. package/dist/models/psql/walletHistoryModel.js +31 -33
  196. package/dist/models/psql/walletModel.d.ts +2 -1
  197. package/dist/models/psql/walletModel.js +28 -46
  198. package/dist/models/psql/workingDayModel.d.ts +3 -2
  199. package/dist/models/psql/workingDayModel.js +18 -31
  200. package/dist/models/psql/workingShiftModel.d.ts +3 -2
  201. package/dist/models/psql/workingShiftModel.js +43 -40
  202. package/dist/types/accountHasReceiptDetailsType.d.ts +1 -1
  203. package/dist/types/bannerType.d.ts +1 -1
  204. package/dist/types/batchSubjectBookAssessmentType.d.ts +1 -1
  205. package/dist/types/batchSubjectProjectAssessmentType.d.ts +1 -1
  206. package/dist/types/batchType.d.ts +1 -1
  207. package/dist/types/bookAssessmentDateType.d.ts +1 -1
  208. package/dist/types/examType.d.ts +1 -1
  209. package/dist/types/feeHistoryType.d.ts +1 -1
  210. package/dist/types/greetingsType.d.ts +1 -1
  211. package/dist/types/holidayType.js +1 -1
  212. package/dist/types/paymentTermsType.js +1 -1
  213. package/dist/types/projectAssessmentOptionType.d.ts +1 -1
  214. package/dist/types/subjectIndexType.d.ts +1 -1
  215. package/dist/types/syllabusType.d.ts +1 -1
  216. package/dist/types/testimonialType.d.ts +1 -1
  217. package/dist/types/userBookAssessmentType.d.ts +1 -1
  218. package/dist/types/userHasBatchType.d.ts +1 -1
  219. package/dist/types/userProjectAssessmentOptionType.d.ts +1 -1
  220. package/package.json +1 -1
@@ -1,20 +1,87 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchModel = void 0;
6
4
  const sequelize_1 = require("sequelize");
7
5
  const index_1 = require("./index");
8
6
  const app_1 = require("../../constants/app");
9
- const userModel_1 = __importDefault(require("./userModel"));
10
- const instituteModel_1 = __importDefault(require("./instituteModel"));
11
- const typeManagementModel_1 = __importDefault(require("./typeManagementModel"));
12
- const workingShiftModel_1 = __importDefault(require("./workingShiftModel"));
13
- const academicCalendarModel_1 = require("./academicCalendarModel");
14
- const slotModel_1 = __importDefault(require("./slotModel"));
15
- const sequelize_2 = require("sequelize");
16
7
  class BatchModel extends sequelize_1.Model {
8
+ static associate(models) {
9
+ const { UserModel, TypeManagementModel, InstituteModel, WorkingShiftModel, SlotModel, AcademicCalendarModel, } = models;
10
+ BatchModel.belongsTo(UserModel, {
11
+ foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
12
+ as: 'createdByUser',
13
+ });
14
+ BatchModel.belongsTo(UserModel, {
15
+ foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
16
+ as: 'updatedByUser',
17
+ });
18
+ BatchModel.belongsTo(UserModel, {
19
+ foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
20
+ as: 'deletedByUser',
21
+ });
22
+ BatchModel.belongsTo(TypeManagementModel, {
23
+ foreignKey: { name: 'type', allowNull: false },
24
+ as: 'batchType',
25
+ });
26
+ BatchModel.belongsTo(InstituteModel, {
27
+ foreignKey: { name: 'instituteId', field: 'institute_id', allowNull: false },
28
+ as: 'institute',
29
+ });
30
+ InstituteModel.hasMany(BatchModel, {
31
+ foreignKey: { name: 'instituteId', field: 'institute_id', allowNull: false },
32
+ as: 'batches',
33
+ });
34
+ BatchModel.belongsTo(UserModel, {
35
+ foreignKey: { name: 'teacherId', field: 'teacher_id', allowNull: true },
36
+ as: 'batchTeacher',
37
+ });
38
+ UserModel.hasMany(BatchModel, {
39
+ foreignKey: { name: 'teacherId', field: 'teacher_id', allowNull: true },
40
+ as: 'batchesHasTeacher',
41
+ });
42
+ BatchModel.belongsTo(WorkingShiftModel, {
43
+ foreignKey: { name: 'shiftId', field: 'shift_id', allowNull: false },
44
+ as: 'shiftBatch',
45
+ });
46
+ WorkingShiftModel.hasMany(BatchModel, {
47
+ foreignKey: { name: 'shiftId', field: 'shift_id', allowNull: false },
48
+ as: 'batchesShift',
49
+ });
50
+ BatchModel.belongsTo(SlotModel, {
51
+ foreignKey: { name: 'slotId', field: 'slot_id', allowNull: false },
52
+ as: 'slotBatch',
53
+ });
54
+ SlotModel.hasMany(BatchModel, {
55
+ foreignKey: { name: 'slotId', field: 'slot_id', allowNull: false },
56
+ as: 'batchesSlot',
57
+ });
58
+ BatchModel.belongsTo(AcademicCalendarModel, {
59
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id', allowNull: true },
60
+ as: 'batchAcademicCalendar',
61
+ });
62
+ AcademicCalendarModel.hasMany(BatchModel, {
63
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id', allowNull: true },
64
+ as: 'academicCalendarBatchList',
65
+ });
66
+ }
67
+ static addHooks() {
68
+ BatchModel.afterBulkCreate(async (instances, options) => {
69
+ for (const instance of instances) {
70
+ await BatchModel.update({ plannerSyncStatus: app_1.PLANNER_SYNC_STATUS.PENDING }, {
71
+ where: { id: { [sequelize_1.Op.in]: [instance.id] } },
72
+ ...(options.transaction && { transaction: options.transaction }),
73
+ });
74
+ }
75
+ });
76
+ BatchModel.afterCreate(async (batch, options) => {
77
+ await BatchModel.update({ plannerSyncStatus: app_1.PLANNER_SYNC_STATUS.PENDING }, {
78
+ where: { id: { [sequelize_1.Op.in]: [batch.id] } },
79
+ ...(options.transaction && { transaction: options.transaction }),
80
+ });
81
+ });
82
+ }
17
83
  }
84
+ exports.BatchModel = BatchModel;
18
85
  BatchModel.init({
19
86
  id: {
20
87
  type: sequelize_1.DataTypes.UUID,
@@ -94,129 +161,4 @@ BatchModel.init({
94
161
  timestamps: true,
95
162
  sequelize: index_1.sequelize,
96
163
  });
97
- BatchModel.belongsTo(userModel_1.default, {
98
- foreignKey: {
99
- name: 'createdBy',
100
- allowNull: true,
101
- field: 'created_by',
102
- },
103
- as: 'createdByUser',
104
- });
105
- BatchModel.belongsTo(userModel_1.default, {
106
- foreignKey: {
107
- name: 'updatedBy',
108
- allowNull: true,
109
- field: 'updated_by',
110
- },
111
- as: 'updatedByUser',
112
- });
113
- BatchModel.belongsTo(userModel_1.default, {
114
- foreignKey: {
115
- name: 'deletedBy',
116
- allowNull: true,
117
- field: 'deleted_by',
118
- },
119
- as: 'deletedByUser',
120
- });
121
- BatchModel.belongsTo(typeManagementModel_1.default, {
122
- foreignKey: {
123
- name: 'type',
124
- allowNull: false,
125
- },
126
- as: 'batchType',
127
- });
128
- BatchModel.belongsTo(instituteModel_1.default, {
129
- foreignKey: {
130
- name: 'instituteId',
131
- field: 'institute_id',
132
- allowNull: false,
133
- },
134
- as: 'institute',
135
- });
136
- userModel_1.default.hasMany(BatchModel, {
137
- foreignKey: {
138
- name: 'teacherId',
139
- field: 'teacher_id',
140
- allowNull: true,
141
- },
142
- as: 'batchesHasTeacher',
143
- });
144
- BatchModel.belongsTo(userModel_1.default, {
145
- foreignKey: {
146
- name: 'teacherId',
147
- field: 'teacher_id',
148
- allowNull: true,
149
- },
150
- as: 'batchTeacher',
151
- });
152
- instituteModel_1.default.hasMany(BatchModel, {
153
- foreignKey: {
154
- name: 'instituteId',
155
- field: 'institute_id',
156
- allowNull: false,
157
- },
158
- as: 'batches',
159
- });
160
- BatchModel.belongsTo(workingShiftModel_1.default, {
161
- foreignKey: {
162
- name: 'shiftId',
163
- field: 'shift_id',
164
- allowNull: false,
165
- },
166
- as: 'shiftBatch',
167
- });
168
- slotModel_1.default.hasMany(BatchModel, {
169
- foreignKey: {
170
- name: 'slotId',
171
- field: 'slot_id',
172
- allowNull: false,
173
- },
174
- as: 'batchesSlot',
175
- });
176
- BatchModel.belongsTo(slotModel_1.default, {
177
- foreignKey: {
178
- name: 'slotId',
179
- field: 'slot_id',
180
- allowNull: false,
181
- },
182
- as: 'slotBatch',
183
- });
184
- workingShiftModel_1.default.hasMany(BatchModel, {
185
- foreignKey: {
186
- name: 'shiftId',
187
- field: 'shift_id',
188
- allowNull: false,
189
- },
190
- as: 'batchesShift',
191
- });
192
- academicCalendarModel_1.AcademicCalendarModel.hasMany(BatchModel, {
193
- foreignKey: {
194
- name: 'academicCalendarId',
195
- field: 'academic_calendar_id',
196
- allowNull: true,
197
- },
198
- as: 'academicCalendarBatchList',
199
- });
200
- BatchModel.belongsTo(academicCalendarModel_1.AcademicCalendarModel, {
201
- foreignKey: {
202
- name: 'academicCalendarId',
203
- field: 'academic_calendar_id',
204
- allowNull: true,
205
- },
206
- as: 'batchAcademicCalendar',
207
- });
208
- BatchModel.afterBulkCreate(async (instances, options) => {
209
- for (const instance of instances) {
210
- await BatchModel.update({ plannerSyncStatus: app_1.PLANNER_SYNC_STATUS.PENDING }, {
211
- where: { id: { [sequelize_2.Op.in]: [instance.id] } },
212
- ...(options.transaction && { transaction: options.transaction }),
213
- });
214
- }
215
- });
216
- BatchModel.afterCreate(async (batch, options) => {
217
- await BatchModel.update({ plannerSyncStatus: app_1.PLANNER_SYNC_STATUS.PENDING }, {
218
- where: { id: { [sequelize_2.Op.in]: [batch.id] } },
219
- ...(options.transaction && { transaction: options.transaction }),
220
- });
221
- });
222
164
  exports.default = BatchModel;
@@ -1,7 +1,7 @@
1
1
  import { Model } from 'sequelize';
2
2
  import { IBatchSubjectBookAssessmentModelAttributes } from '../../interfaces/batchSubjectBookAssessmentInterface';
3
3
  import { TBatchSubjectBookAssessmentModelCreationAttributes } from '../../types/batchSubjectBookAssessmentType';
4
- declare class BatchSubjectBookAssessmentModel extends Model<IBatchSubjectBookAssessmentModelAttributes, TBatchSubjectBookAssessmentModelCreationAttributes> {
4
+ export declare class BatchSubjectBookAssessmentModel extends Model<IBatchSubjectBookAssessmentModelAttributes, TBatchSubjectBookAssessmentModelCreationAttributes> {
5
5
  id: string;
6
6
  batchId: string;
7
7
  subjectId: string;
@@ -14,5 +14,6 @@ declare class BatchSubjectBookAssessmentModel extends Model<IBatchSubjectBookAss
14
14
  readonly createdAt: Date;
15
15
  readonly deletedAt: string;
16
16
  readonly updatedAt: Date;
17
+ static associate(models: any): void;
17
18
  }
18
19
  export default BatchSubjectBookAssessmentModel;
@@ -1,17 +1,66 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchSubjectBookAssessmentModel = void 0;
6
4
  const sequelize_1 = require("sequelize");
7
5
  const index_1 = require("./index");
8
- const instituteModel_1 = __importDefault(require("./instituteModel"));
9
- const userModel_1 = __importDefault(require("./userModel"));
10
- const batchModel_1 = __importDefault(require("./batchModel"));
11
- const typeManagementModel_1 = __importDefault(require("./typeManagementModel"));
12
- const instituteEntityModel_1 = __importDefault(require("./instituteEntityModel"));
13
6
  class BatchSubjectBookAssessmentModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { InstituteModel, UserModel, BatchModel, TypeManagementModel, InstituteEntityModel, } = models;
9
+ BatchSubjectBookAssessmentModel.belongsTo(InstituteModel, {
10
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
11
+ as: 'subjectBookAssessmentInstitute',
12
+ });
13
+ InstituteModel.hasMany(BatchSubjectBookAssessmentModel, {
14
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
15
+ as: 'instituteSubjectBookAssessmentList',
16
+ });
17
+ BatchSubjectBookAssessmentModel.belongsTo(BatchModel, {
18
+ foreignKey: { name: 'batchId', field: 'batch_id' },
19
+ as: 'subjectBookAssessmentBatch',
20
+ });
21
+ BatchModel.hasMany(BatchSubjectBookAssessmentModel, {
22
+ foreignKey: { name: 'batchId', field: 'batch_id' },
23
+ as: 'batchSubjectBookAssessmentList',
24
+ });
25
+ BatchSubjectBookAssessmentModel.belongsTo(TypeManagementModel, {
26
+ foreignKey: { name: 'assessmentType', field: 'assessment_type' },
27
+ as: 'subjectBookAssessmentType',
28
+ });
29
+ TypeManagementModel.hasMany(BatchSubjectBookAssessmentModel, {
30
+ foreignKey: { name: 'assessmentType', field: 'assessment_type' },
31
+ as: 'bookAssessmentTypeAssessmentList',
32
+ });
33
+ InstituteEntityModel.hasMany(BatchSubjectBookAssessmentModel, {
34
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
35
+ as: 'subjectBookAssessmentList',
36
+ });
37
+ BatchSubjectBookAssessmentModel.belongsTo(InstituteEntityModel, {
38
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
39
+ as: 'bookAssessmentSubject',
40
+ });
41
+ InstituteEntityModel.hasMany(BatchSubjectBookAssessmentModel, {
42
+ foreignKey: { name: 'standardId', field: 'standard_id' },
43
+ as: 'standardBookAssessmentList',
44
+ });
45
+ BatchSubjectBookAssessmentModel.belongsTo(InstituteEntityModel, {
46
+ foreignKey: { name: 'standardId', field: 'standard_id' },
47
+ as: 'bookAssessmentStandard',
48
+ });
49
+ BatchSubjectBookAssessmentModel.belongsTo(UserModel, {
50
+ foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
51
+ as: 'createdByUser',
52
+ });
53
+ BatchSubjectBookAssessmentModel.belongsTo(UserModel, {
54
+ foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
55
+ as: 'updatedByUser',
56
+ });
57
+ BatchSubjectBookAssessmentModel.belongsTo(UserModel, {
58
+ foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
59
+ as: 'deletedByUser',
60
+ });
61
+ }
14
62
  }
63
+ exports.BatchSubjectBookAssessmentModel = BatchSubjectBookAssessmentModel;
15
64
  BatchSubjectBookAssessmentModel.init({
16
65
  id: {
17
66
  type: sequelize_1.DataTypes.UUID,
@@ -53,104 +102,8 @@ BatchSubjectBookAssessmentModel.init({
53
102
  name: 'batch_subject_standard_institute',
54
103
  unique: true,
55
104
  fields: ['batch_id', 'subject_id', 'standard_id', 'institute_id', 'assessment_type'],
56
- // eslint-disable-next-line camelcase
57
105
  where: { deleted_at: null },
58
106
  },
59
107
  ],
60
108
  });
61
- // Associations
62
- BatchSubjectBookAssessmentModel.belongsTo(instituteModel_1.default, {
63
- foreignKey: {
64
- name: 'instituteId',
65
- field: 'institute_id',
66
- },
67
- as: 'subjectBookAssessmentInstitute',
68
- });
69
- instituteModel_1.default.hasMany(BatchSubjectBookAssessmentModel, {
70
- foreignKey: {
71
- name: 'instituteId',
72
- field: 'institute_id',
73
- },
74
- as: 'instituteSubjectBookAssessmentList',
75
- });
76
- BatchSubjectBookAssessmentModel.belongsTo(batchModel_1.default, {
77
- foreignKey: {
78
- name: 'batchId',
79
- field: 'batch_id',
80
- },
81
- as: 'subjectBookAssessmentBatch',
82
- });
83
- batchModel_1.default.hasMany(BatchSubjectBookAssessmentModel, {
84
- foreignKey: {
85
- name: 'batchId',
86
- field: 'batch_id',
87
- },
88
- as: 'batchSubjectBookAssessmentList',
89
- });
90
- BatchSubjectBookAssessmentModel.belongsTo(typeManagementModel_1.default, {
91
- foreignKey: {
92
- name: 'assessmentType',
93
- field: 'assessment_type',
94
- },
95
- as: 'subjectBookAssessmentType',
96
- });
97
- typeManagementModel_1.default.hasMany(BatchSubjectBookAssessmentModel, {
98
- foreignKey: {
99
- name: 'assessmentType',
100
- field: 'assessment_type',
101
- },
102
- as: 'bookAssessmentTypeAssessmentList',
103
- });
104
- instituteEntityModel_1.default.hasMany(BatchSubjectBookAssessmentModel, {
105
- foreignKey: {
106
- name: 'subjectId',
107
- field: 'subject_id',
108
- },
109
- as: 'subjectBookAssessmentList',
110
- });
111
- BatchSubjectBookAssessmentModel.belongsTo(instituteEntityModel_1.default, {
112
- foreignKey: {
113
- name: 'subjectId',
114
- field: 'subject_id',
115
- },
116
- as: 'bookAssessmentSubject',
117
- });
118
- instituteEntityModel_1.default.hasMany(BatchSubjectBookAssessmentModel, {
119
- foreignKey: {
120
- name: 'standardId',
121
- field: 'standard_id',
122
- },
123
- as: 'standardBookAssessmentList',
124
- });
125
- BatchSubjectBookAssessmentModel.belongsTo(instituteEntityModel_1.default, {
126
- foreignKey: {
127
- name: 'standardId',
128
- field: 'standard_id',
129
- },
130
- as: 'bookAssessmentStandard',
131
- });
132
- BatchSubjectBookAssessmentModel.belongsTo(userModel_1.default, {
133
- foreignKey: {
134
- name: 'createdBy',
135
- allowNull: true,
136
- field: 'created_by',
137
- },
138
- as: 'createdByUser',
139
- });
140
- BatchSubjectBookAssessmentModel.belongsTo(userModel_1.default, {
141
- foreignKey: {
142
- name: 'updatedBy',
143
- allowNull: true,
144
- field: 'updated_by',
145
- },
146
- as: 'updatedByUser',
147
- });
148
- BatchSubjectBookAssessmentModel.belongsTo(userModel_1.default, {
149
- foreignKey: {
150
- name: 'deletedBy',
151
- allowNull: true,
152
- field: 'deleted_by',
153
- },
154
- as: 'deletedByUser',
155
- });
156
109
  exports.default = BatchSubjectBookAssessmentModel;
@@ -1,7 +1,7 @@
1
1
  import { Model } from 'sequelize';
2
2
  import { IBatchSubjectProjectAssessmentModelAttributes } from '../../interfaces/batchSubjectProjectAssessmentInterface';
3
3
  import { TBatchSubjectProjectAssessmentModelCreationAttributes } from '../../types/batchSubjectProjectAssessmentType';
4
- declare class BatchSubjectProjectAssessmentModel extends Model<IBatchSubjectProjectAssessmentModelAttributes, TBatchSubjectProjectAssessmentModelCreationAttributes> {
4
+ export declare class BatchSubjectProjectAssessmentModel extends Model<IBatchSubjectProjectAssessmentModelAttributes, TBatchSubjectProjectAssessmentModelCreationAttributes> {
5
5
  id: string;
6
6
  batchId: string;
7
7
  subjectId: string;
@@ -17,5 +17,6 @@ declare class BatchSubjectProjectAssessmentModel extends Model<IBatchSubjectProj
17
17
  readonly createdAt: Date;
18
18
  readonly deletedAt: string;
19
19
  readonly updatedAt: Date;
20
+ static associate(models: any): void;
20
21
  }
21
22
  export default BatchSubjectProjectAssessmentModel;
@@ -1,16 +1,58 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchSubjectProjectAssessmentModel = void 0;
6
4
  const sequelize_1 = require("sequelize");
7
5
  const index_1 = require("./index");
8
- const instituteModel_1 = __importDefault(require("./instituteModel"));
9
- const userModel_1 = __importDefault(require("./userModel"));
10
- const batchModel_1 = __importDefault(require("./batchModel"));
11
- const instituteEntityModel_1 = __importDefault(require("./instituteEntityModel"));
12
6
  class BatchSubjectProjectAssessmentModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { InstituteModel, UserModel, BatchModel, InstituteEntityModel, } = models;
9
+ BatchSubjectProjectAssessmentModel.belongsTo(InstituteModel, {
10
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
11
+ as: 'subjectProjectAssessmentInstitute',
12
+ });
13
+ InstituteModel.hasMany(BatchSubjectProjectAssessmentModel, {
14
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
15
+ as: 'instituteSubjectProjectAssessmentList',
16
+ });
17
+ BatchSubjectProjectAssessmentModel.belongsTo(BatchModel, {
18
+ foreignKey: { name: 'batchId', field: 'batch_id' },
19
+ as: 'subjectProjectAssessmentBatch',
20
+ });
21
+ BatchModel.hasMany(BatchSubjectProjectAssessmentModel, {
22
+ foreignKey: { name: 'batchId', field: 'batch_id' },
23
+ as: 'batchSubjectProjectAssessmentList',
24
+ });
25
+ InstituteEntityModel.hasMany(BatchSubjectProjectAssessmentModel, {
26
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
27
+ as: 'subjectProjectAssessmentList',
28
+ });
29
+ BatchSubjectProjectAssessmentModel.belongsTo(InstituteEntityModel, {
30
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
31
+ as: 'projectAssessmentSubject',
32
+ });
33
+ InstituteEntityModel.hasMany(BatchSubjectProjectAssessmentModel, {
34
+ foreignKey: { name: 'standardId', field: 'standard_id' },
35
+ as: 'standardProjectAssessmentList',
36
+ });
37
+ BatchSubjectProjectAssessmentModel.belongsTo(InstituteEntityModel, {
38
+ foreignKey: { name: 'standardId', field: 'standard_id' },
39
+ as: 'projectAssessmentStandard',
40
+ });
41
+ BatchSubjectProjectAssessmentModel.belongsTo(UserModel, {
42
+ foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
43
+ as: 'createdByUser',
44
+ });
45
+ BatchSubjectProjectAssessmentModel.belongsTo(UserModel, {
46
+ foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
47
+ as: 'updatedByUser',
48
+ });
49
+ BatchSubjectProjectAssessmentModel.belongsTo(UserModel, {
50
+ foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
51
+ as: 'deletedByUser',
52
+ });
53
+ }
13
54
  }
55
+ exports.BatchSubjectProjectAssessmentModel = BatchSubjectProjectAssessmentModel;
14
56
  BatchSubjectProjectAssessmentModel.init({
15
57
  id: {
16
58
  type: sequelize_1.DataTypes.UUID,
@@ -56,99 +98,24 @@ BatchSubjectProjectAssessmentModel.init({
56
98
  type: sequelize_1.DataTypes.TEXT,
57
99
  allowNull: true,
58
100
  },
59
- }, {
60
- modelName: 'BatchSubjectProjectAssessmentModel',
61
- tableName: 'batch_subject_project_assessments',
62
- sequelize: index_1.sequelize,
63
- // indexes: [
64
- // {
65
- // name: 'batch_subject_project_assessments_unique',
66
- // unique: true,
67
- // fields: ['batch_id', 'subject_id', 'standard_id', 'institute_id'],
68
- // // eslint-disable-next-line camelcase
69
- // where: { deleted_at: null },
70
- // },
71
- // ],
72
- });
73
- // Associations
74
- BatchSubjectProjectAssessmentModel.belongsTo(instituteModel_1.default, {
75
- foreignKey: {
76
- name: 'instituteId',
77
- field: 'institute_id',
78
- },
79
- as: 'subjectProjectAssessmentInstitute',
80
- });
81
- instituteModel_1.default.hasMany(BatchSubjectProjectAssessmentModel, {
82
- foreignKey: {
83
- name: 'instituteId',
84
- field: 'institute_id',
85
- },
86
- as: 'instituteSubjectProjectAssessmentList',
87
- });
88
- BatchSubjectProjectAssessmentModel.belongsTo(batchModel_1.default, {
89
- foreignKey: {
90
- name: 'batchId',
91
- field: 'batch_id',
92
- },
93
- as: 'subjectProjectAssessmentBatch',
94
- });
95
- batchModel_1.default.hasMany(BatchSubjectProjectAssessmentModel, {
96
- foreignKey: {
97
- name: 'batchId',
98
- field: 'batch_id',
99
- },
100
- as: 'batchSubjectProjectAssessmentList',
101
- });
102
- instituteEntityModel_1.default.hasMany(BatchSubjectProjectAssessmentModel, {
103
- foreignKey: {
104
- name: 'subjectId',
105
- field: 'subject_id',
106
- },
107
- as: 'subjectProjectAssessmentList',
108
- });
109
- BatchSubjectProjectAssessmentModel.belongsTo(instituteEntityModel_1.default, {
110
- foreignKey: {
111
- name: 'subjectId',
112
- field: 'subject_id',
113
- },
114
- as: 'projectAssessmentSubject',
115
- });
116
- instituteEntityModel_1.default.hasMany(BatchSubjectProjectAssessmentModel, {
117
- foreignKey: {
118
- name: 'standardId',
119
- field: 'standard_id',
120
- },
121
- as: 'standardProjectAssessmentList',
122
- });
123
- BatchSubjectProjectAssessmentModel.belongsTo(instituteEntityModel_1.default, {
124
- foreignKey: {
125
- name: 'standardId',
126
- field: 'standard_id',
127
- },
128
- as: 'projectAssessmentStandard',
129
- });
130
- BatchSubjectProjectAssessmentModel.belongsTo(userModel_1.default, {
131
- foreignKey: {
132
- name: 'createdBy',
101
+ createdBy: {
102
+ type: sequelize_1.DataTypes.UUID,
133
103
  allowNull: true,
134
104
  field: 'created_by',
135
105
  },
136
- as: 'createdByUser',
137
- });
138
- BatchSubjectProjectAssessmentModel.belongsTo(userModel_1.default, {
139
- foreignKey: {
140
- name: 'updatedBy',
106
+ updatedBy: {
107
+ type: sequelize_1.DataTypes.UUID,
141
108
  allowNull: true,
142
109
  field: 'updated_by',
143
110
  },
144
- as: 'updatedByUser',
145
- });
146
- BatchSubjectProjectAssessmentModel.belongsTo(userModel_1.default, {
147
- foreignKey: {
148
- name: 'deletedBy',
111
+ deletedBy: {
112
+ type: sequelize_1.DataTypes.UUID,
149
113
  allowNull: true,
150
114
  field: 'deleted_by',
151
115
  },
152
- as: 'deletedByUser',
116
+ }, {
117
+ modelName: 'BatchSubjectProjectAssessmentModel',
118
+ tableName: 'batch_subject_project_assessments',
119
+ sequelize: index_1.sequelize,
153
120
  });
154
121
  exports.default = BatchSubjectProjectAssessmentModel;
@@ -2,7 +2,7 @@ import { Model } from 'sequelize';
2
2
  import { IBookAssessmentDateModelAttributes } from '../../interfaces/bookAssessmentDateInterface';
3
3
  import { TBookAssessmentDateModelCreationAttributes } from '../../types/bookAssessmentDateType';
4
4
  import { BOOK_ASSESSMENT_DATE_STATUS } from '../../constants/app';
5
- declare class BookAssessmentDateModel extends Model<IBookAssessmentDateModelAttributes, TBookAssessmentDateModelCreationAttributes> {
5
+ export declare class BookAssessmentDateModel extends Model<IBookAssessmentDateModelAttributes, TBookAssessmentDateModelCreationAttributes> {
6
6
  id: string;
7
7
  assessmentBookId: string;
8
8
  date: Date;
@@ -13,5 +13,6 @@ declare class BookAssessmentDateModel extends Model<IBookAssessmentDateModelAttr
13
13
  readonly createdAt: Date;
14
14
  readonly deletedAt: string;
15
15
  readonly updatedAt: Date;
16
+ static associate(models: any): void;
16
17
  }
17
18
  export default BookAssessmentDateModel;