@kipicore/dbcore 1.1.5 → 1.1.6
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.
- package/README.md +1 -1
- package/dist/constants/app.js +0 -1
- package/dist/db/mongodb.js +4 -4
- package/dist/db/postgres.d.ts +1 -1
- package/dist/db/postgres.js +5 -5
- package/dist/index.d.ts +417 -415
- package/dist/index.js +742 -428
- package/dist/models/mongodb/attendanceModel.d.ts +2 -2
- package/dist/models/mongodb/attendanceModel.js +7 -8
- package/dist/models/mongodb/eventModel.d.ts +2 -2
- package/dist/models/mongodb/eventModel.js +3 -3
- package/dist/models/mongodb/examGroupModel.d.ts +2 -2
- package/dist/models/mongodb/examGroupModel.js +22 -28
- package/dist/models/mongodb/examHasAnswerSheetModel.d.ts +2 -2
- package/dist/models/mongodb/examHasAnswerSheetModel.js +5 -6
- package/dist/models/mongodb/examModel.d.ts +2 -2
- package/dist/models/mongodb/examModel.js +7 -10
- package/dist/models/mongodb/holidayModel.d.ts +2 -2
- package/dist/models/mongodb/holidayModel.js +4 -6
- package/dist/models/mongodb/inquiryModel.d.ts +2 -2
- package/dist/models/mongodb/inquiryModel.js +3 -4
- package/dist/models/mongodb/plugin/transformIdInResponsePlugin.d.ts +1 -1
- package/dist/models/mongodb/plugin/transformIdInResponsePlugin.js +4 -6
- package/dist/models/mongodb/schoolFeeModel.d.ts +2 -2
- package/dist/models/mongodb/schoolFeeModel.js +3 -3
- package/dist/models/mongodb/subjectIndexModel.d.ts +2 -2
- package/dist/models/mongodb/subjectIndexModel.js +66 -108
- package/dist/models/mongodb/subscriptionPlanModel.d.ts +2 -2
- package/dist/models/mongodb/subscriptionPlanModel.js +1 -1
- package/dist/models/mongodb/taskManagementModel.d.ts +2 -2
- package/dist/models/mongodb/taskManagementModel.js +3 -3
- package/dist/models/mongodb/userDoc.d.ts +1 -1
- package/dist/models/mongodb/userDoc.js +1 -1
- package/dist/models/mongodb/userSchoolMetaModel.d.ts +1 -1
- package/dist/models/mongodb/userSchoolMetaModel.js +8 -8
- package/dist/models/psql/announcementModel.d.ts +4 -4
- package/dist/models/psql/announcementModel.js +25 -25
- package/dist/models/psql/batchModel.d.ts +4 -4
- package/dist/models/psql/batchModel.js +51 -51
- package/dist/models/psql/driverModel.d.ts +4 -4
- package/dist/models/psql/driverModel.js +28 -28
- package/dist/models/psql/facilityModel.d.ts +4 -4
- package/dist/models/psql/facilityModel.js +23 -23
- package/dist/models/psql/feeHistoryModel.d.ts +4 -4
- package/dist/models/psql/feeHistoryModel.js +64 -65
- package/dist/models/psql/feeReminderModel.d.ts +3 -3
- package/dist/models/psql/feeReminderModel.js +32 -32
- package/dist/models/psql/feesCollectionModel.d.ts +4 -4
- package/dist/models/psql/feesCollectionModel.js +36 -37
- package/dist/models/psql/index.d.ts +1 -1
- package/dist/models/psql/index.js +12 -12
- package/dist/models/psql/lectureModel.d.ts +4 -4
- package/dist/models/psql/lectureModel.js +75 -84
- package/dist/models/psql/masterLeaveModel.d.ts +4 -4
- package/dist/models/psql/masterLeaveModel.js +22 -23
- package/dist/models/psql/testimonialModel.d.ts +4 -4
- package/dist/models/psql/testimonialModel.js +25 -27
- package/dist/models/psql/toDoModel.d.ts +4 -4
- package/dist/models/psql/toDoModel.js +23 -23
- package/dist/models/psql/typeManagementModel.d.ts +4 -4
- package/dist/models/psql/typeManagementModel.js +19 -19
- package/dist/models/psql/userModel.d.ts +4 -4
- package/dist/models/psql/userModel.js +47 -48
- package/dist/models/psql/userPayoutModel.d.ts +4 -4
- package/dist/models/psql/userPayoutModel.js +55 -70
- package/dist/services/Concrete/mongooseCommonService.d.ts +4 -4
- package/dist/services/Concrete/mongooseCommonService.js +2 -4
- package/dist/services/Contracts/IMongooseCommonService.d.ts +2 -2
- package/dist/services/Contracts/ISequelizeCommonService.d.ts +12 -12
- package/dist/types/generateIdCardType.d.ts +2 -2
- package/package.json +49 -47
|
@@ -59,12 +59,12 @@ AnnouncementModel.init({
|
|
|
59
59
|
},
|
|
60
60
|
instituteId: {
|
|
61
61
|
type: sequelize_1.DataTypes.UUID,
|
|
62
|
-
field:
|
|
62
|
+
field: 'institute_id',
|
|
63
63
|
allowNull: true,
|
|
64
64
|
},
|
|
65
65
|
userIds: {
|
|
66
66
|
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.UUID),
|
|
67
|
-
field:
|
|
67
|
+
field: 'user_ids',
|
|
68
68
|
defaultValue: [],
|
|
69
69
|
allowNull: true,
|
|
70
70
|
},
|
|
@@ -84,67 +84,67 @@ AnnouncementModel.init({
|
|
|
84
84
|
},
|
|
85
85
|
entityIds: {
|
|
86
86
|
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.UUID),
|
|
87
|
-
field:
|
|
87
|
+
field: 'entity_ids',
|
|
88
88
|
defaultValue: [],
|
|
89
89
|
allowNull: false,
|
|
90
90
|
},
|
|
91
91
|
}, {
|
|
92
|
-
modelName:
|
|
93
|
-
tableName:
|
|
92
|
+
modelName: 'AnnouncementModel',
|
|
93
|
+
tableName: 'announcementes',
|
|
94
94
|
timestamps: true,
|
|
95
95
|
sequelize: index_js_1.sequelize,
|
|
96
96
|
});
|
|
97
97
|
AnnouncementModel.belongsTo(userModel_js_1.default, {
|
|
98
98
|
foreignKey: {
|
|
99
|
-
name:
|
|
99
|
+
name: 'createdBy',
|
|
100
100
|
allowNull: true,
|
|
101
|
-
field:
|
|
101
|
+
field: 'created_by',
|
|
102
102
|
},
|
|
103
|
-
as:
|
|
103
|
+
as: 'createdByUser',
|
|
104
104
|
});
|
|
105
105
|
AnnouncementModel.belongsTo(userModel_js_1.default, {
|
|
106
106
|
foreignKey: {
|
|
107
|
-
name:
|
|
107
|
+
name: 'updatedBy',
|
|
108
108
|
allowNull: true,
|
|
109
|
-
field:
|
|
109
|
+
field: 'updated_by',
|
|
110
110
|
},
|
|
111
|
-
as:
|
|
111
|
+
as: 'updatedByUser',
|
|
112
112
|
});
|
|
113
113
|
AnnouncementModel.belongsTo(userModel_js_1.default, {
|
|
114
114
|
foreignKey: {
|
|
115
|
-
name:
|
|
115
|
+
name: 'deletedBy',
|
|
116
116
|
allowNull: true,
|
|
117
|
-
field:
|
|
117
|
+
field: 'deleted_by',
|
|
118
118
|
},
|
|
119
|
-
as:
|
|
119
|
+
as: 'deletedByUser',
|
|
120
120
|
});
|
|
121
121
|
AnnouncementModel.belongsTo(instituteModel_js_1.default, {
|
|
122
122
|
foreignKey: {
|
|
123
|
-
name:
|
|
123
|
+
name: 'instituteId',
|
|
124
124
|
},
|
|
125
|
-
as:
|
|
125
|
+
as: 'institute',
|
|
126
126
|
});
|
|
127
127
|
instituteModel_js_1.default.hasMany(AnnouncementModel, {
|
|
128
128
|
foreignKey: {
|
|
129
|
-
name:
|
|
129
|
+
name: 'instituteId',
|
|
130
130
|
},
|
|
131
|
-
as:
|
|
131
|
+
as: 'instituteHasAnnouncementList',
|
|
132
132
|
});
|
|
133
133
|
AnnouncementModel.belongsTo(fileStorageModel_js_1.default, {
|
|
134
134
|
foreignKey: {
|
|
135
|
-
name:
|
|
135
|
+
name: 'fileStorageId',
|
|
136
136
|
},
|
|
137
|
-
as:
|
|
137
|
+
as: 'announcementFileStorage',
|
|
138
138
|
});
|
|
139
139
|
fileStorageModel_js_1.default.hasMany(AnnouncementModel, {
|
|
140
|
-
foreignKey:
|
|
141
|
-
as:
|
|
140
|
+
foreignKey: 'fileStorageId',
|
|
141
|
+
as: 'announcementHasFileList',
|
|
142
142
|
});
|
|
143
143
|
AnnouncementModel.beforeCreate(async (announcement) => {
|
|
144
144
|
if (announcement.subjects && announcement.subjects.length) {
|
|
145
145
|
const where = { id: { [sequelize_1.Op.in]: announcement.subjects } };
|
|
146
146
|
const options = {
|
|
147
|
-
include: { association:
|
|
147
|
+
include: { association: 'entityType', where: { sequence: 'LAST' } },
|
|
148
148
|
raw: false,
|
|
149
149
|
};
|
|
150
150
|
const entityListCount = await instituteEntityModel_js_1.default.count({
|
|
@@ -178,8 +178,8 @@ AnnouncementModel.beforeBulkUpdate(async (options) => {
|
|
|
178
178
|
const entityList = await instituteEntityModel_js_1.default.findAll({
|
|
179
179
|
where,
|
|
180
180
|
include: {
|
|
181
|
-
association:
|
|
182
|
-
where: { sequene:
|
|
181
|
+
association: 'entityType',
|
|
182
|
+
where: { sequene: 'LAST' },
|
|
183
183
|
},
|
|
184
184
|
raw: false, // Ensure you get Sequelize instances
|
|
185
185
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Model } from
|
|
2
|
-
import { IBatchModelAttributes } from
|
|
3
|
-
import { TBatchModelCreationAttributes } from
|
|
4
|
-
import { COMMAN_STATUS, PLANNER_SYNC_STATUS } from
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IBatchModelAttributes } from '../../interfaces/batchInterface.js';
|
|
3
|
+
import { TBatchModelCreationAttributes } from '../../types/batchType.js';
|
|
4
|
+
import { COMMAN_STATUS, PLANNER_SYNC_STATUS } from '../../constants/app.js';
|
|
5
5
|
declare class BatchModel extends Model<IBatchModelAttributes, TBatchModelCreationAttributes> {
|
|
6
6
|
id: string;
|
|
7
7
|
title: string;
|
|
@@ -38,12 +38,12 @@ BatchModel.init({
|
|
|
38
38
|
},
|
|
39
39
|
startTime: {
|
|
40
40
|
type: sequelize_1.DataTypes.DATE,
|
|
41
|
-
field:
|
|
41
|
+
field: 'start_time',
|
|
42
42
|
allowNull: false,
|
|
43
43
|
},
|
|
44
44
|
endTime: {
|
|
45
45
|
type: sequelize_1.DataTypes.DATE,
|
|
46
|
-
field:
|
|
46
|
+
field: 'end_time',
|
|
47
47
|
allowNull: false,
|
|
48
48
|
},
|
|
49
49
|
capacity: {
|
|
@@ -52,22 +52,22 @@ BatchModel.init({
|
|
|
52
52
|
},
|
|
53
53
|
instituteId: {
|
|
54
54
|
type: sequelize_1.DataTypes.UUID,
|
|
55
|
-
field:
|
|
55
|
+
field: 'institute_id',
|
|
56
56
|
allowNull: false,
|
|
57
57
|
},
|
|
58
58
|
shiftId: {
|
|
59
59
|
type: sequelize_1.DataTypes.UUID,
|
|
60
|
-
field:
|
|
60
|
+
field: 'shift_id',
|
|
61
61
|
allowNull: true,
|
|
62
62
|
},
|
|
63
63
|
slotId: {
|
|
64
64
|
type: sequelize_1.DataTypes.UUID,
|
|
65
|
-
field:
|
|
65
|
+
field: 'slot_id',
|
|
66
66
|
allowNull: true,
|
|
67
67
|
},
|
|
68
68
|
teacherId: {
|
|
69
69
|
type: sequelize_1.DataTypes.UUID,
|
|
70
|
-
field:
|
|
70
|
+
field: 'teacher_id',
|
|
71
71
|
defaultValue: null,
|
|
72
72
|
allowNull: true,
|
|
73
73
|
},
|
|
@@ -78,132 +78,132 @@ BatchModel.init({
|
|
|
78
78
|
},
|
|
79
79
|
plannerSyncStatus: {
|
|
80
80
|
type: sequelize_1.DataTypes.STRING,
|
|
81
|
-
field:
|
|
81
|
+
field: 'planner_sync_status',
|
|
82
82
|
allowNull: true,
|
|
83
83
|
defaultValue: app_js_1.PLANNER_SYNC_STATUS.PENDING,
|
|
84
84
|
},
|
|
85
85
|
academicCalendarId: {
|
|
86
86
|
type: sequelize_1.DataTypes.UUID,
|
|
87
|
-
field:
|
|
87
|
+
field: 'academic_calendar_id',
|
|
88
88
|
defaultValue: null,
|
|
89
89
|
allowNull: true,
|
|
90
90
|
},
|
|
91
91
|
}, {
|
|
92
|
-
modelName:
|
|
93
|
-
tableName:
|
|
92
|
+
modelName: 'BatchModel',
|
|
93
|
+
tableName: 'batches',
|
|
94
94
|
timestamps: true,
|
|
95
95
|
sequelize: index_js_1.sequelize,
|
|
96
96
|
});
|
|
97
97
|
BatchModel.belongsTo(userModel_js_1.default, {
|
|
98
98
|
foreignKey: {
|
|
99
|
-
name:
|
|
99
|
+
name: 'createdBy',
|
|
100
100
|
allowNull: true,
|
|
101
|
-
field:
|
|
101
|
+
field: 'created_by',
|
|
102
102
|
},
|
|
103
|
-
as:
|
|
103
|
+
as: 'createdByUser',
|
|
104
104
|
});
|
|
105
105
|
BatchModel.belongsTo(userModel_js_1.default, {
|
|
106
106
|
foreignKey: {
|
|
107
|
-
name:
|
|
107
|
+
name: 'updatedBy',
|
|
108
108
|
allowNull: true,
|
|
109
|
-
field:
|
|
109
|
+
field: 'updated_by',
|
|
110
110
|
},
|
|
111
|
-
as:
|
|
111
|
+
as: 'updatedByUser',
|
|
112
112
|
});
|
|
113
113
|
BatchModel.belongsTo(userModel_js_1.default, {
|
|
114
114
|
foreignKey: {
|
|
115
|
-
name:
|
|
115
|
+
name: 'deletedBy',
|
|
116
116
|
allowNull: true,
|
|
117
|
-
field:
|
|
117
|
+
field: 'deleted_by',
|
|
118
118
|
},
|
|
119
|
-
as:
|
|
119
|
+
as: 'deletedByUser',
|
|
120
120
|
});
|
|
121
121
|
BatchModel.belongsTo(typeManagementModel_js_1.default, {
|
|
122
122
|
foreignKey: {
|
|
123
|
-
name:
|
|
123
|
+
name: 'type',
|
|
124
124
|
allowNull: false,
|
|
125
125
|
},
|
|
126
|
-
as:
|
|
126
|
+
as: 'batchType',
|
|
127
127
|
});
|
|
128
128
|
BatchModel.belongsTo(instituteModel_js_1.default, {
|
|
129
129
|
foreignKey: {
|
|
130
|
-
name:
|
|
131
|
-
field:
|
|
130
|
+
name: 'instituteId',
|
|
131
|
+
field: 'institute_id',
|
|
132
132
|
allowNull: false,
|
|
133
133
|
},
|
|
134
|
-
as:
|
|
134
|
+
as: 'institute',
|
|
135
135
|
});
|
|
136
136
|
userModel_js_1.default.hasMany(BatchModel, {
|
|
137
137
|
foreignKey: {
|
|
138
|
-
name:
|
|
139
|
-
field:
|
|
138
|
+
name: 'teacherId',
|
|
139
|
+
field: 'teacher_id',
|
|
140
140
|
allowNull: true,
|
|
141
141
|
},
|
|
142
|
-
as:
|
|
142
|
+
as: 'batchesHasTeacher',
|
|
143
143
|
});
|
|
144
144
|
BatchModel.belongsTo(userModel_js_1.default, {
|
|
145
145
|
foreignKey: {
|
|
146
|
-
name:
|
|
147
|
-
field:
|
|
146
|
+
name: 'teacherId',
|
|
147
|
+
field: 'teacher_id',
|
|
148
148
|
allowNull: true,
|
|
149
149
|
},
|
|
150
|
-
as:
|
|
150
|
+
as: 'batchTeacher',
|
|
151
151
|
});
|
|
152
152
|
instituteModel_js_1.default.hasMany(BatchModel, {
|
|
153
153
|
foreignKey: {
|
|
154
|
-
name:
|
|
155
|
-
field:
|
|
154
|
+
name: 'instituteId',
|
|
155
|
+
field: 'institute_id',
|
|
156
156
|
allowNull: false,
|
|
157
157
|
},
|
|
158
|
-
as:
|
|
158
|
+
as: 'batches',
|
|
159
159
|
});
|
|
160
160
|
BatchModel.belongsTo(workingShiftModel_js_1.default, {
|
|
161
161
|
foreignKey: {
|
|
162
|
-
name:
|
|
163
|
-
field:
|
|
162
|
+
name: 'shiftId',
|
|
163
|
+
field: 'shift_id',
|
|
164
164
|
allowNull: false,
|
|
165
165
|
},
|
|
166
|
-
as:
|
|
166
|
+
as: 'shiftBatch',
|
|
167
167
|
});
|
|
168
168
|
slotModel_js_1.default.hasMany(BatchModel, {
|
|
169
169
|
foreignKey: {
|
|
170
|
-
name:
|
|
171
|
-
field:
|
|
170
|
+
name: 'slotId',
|
|
171
|
+
field: 'slot_id',
|
|
172
172
|
allowNull: false,
|
|
173
173
|
},
|
|
174
|
-
as:
|
|
174
|
+
as: 'batchesSlot',
|
|
175
175
|
});
|
|
176
176
|
BatchModel.belongsTo(slotModel_js_1.default, {
|
|
177
177
|
foreignKey: {
|
|
178
|
-
name:
|
|
179
|
-
field:
|
|
178
|
+
name: 'slotId',
|
|
179
|
+
field: 'slot_id',
|
|
180
180
|
allowNull: false,
|
|
181
181
|
},
|
|
182
|
-
as:
|
|
182
|
+
as: 'slotBatch',
|
|
183
183
|
});
|
|
184
184
|
workingShiftModel_js_1.default.hasMany(BatchModel, {
|
|
185
185
|
foreignKey: {
|
|
186
|
-
name:
|
|
187
|
-
field:
|
|
186
|
+
name: 'shiftId',
|
|
187
|
+
field: 'shift_id',
|
|
188
188
|
allowNull: false,
|
|
189
189
|
},
|
|
190
|
-
as:
|
|
190
|
+
as: 'batchesShift',
|
|
191
191
|
});
|
|
192
192
|
academicCalendarModel_js_1.default.hasMany(BatchModel, {
|
|
193
193
|
foreignKey: {
|
|
194
|
-
name:
|
|
195
|
-
field:
|
|
194
|
+
name: 'academicCalendarId',
|
|
195
|
+
field: 'academic_calendar_id',
|
|
196
196
|
allowNull: true,
|
|
197
197
|
},
|
|
198
|
-
as:
|
|
198
|
+
as: 'academicCalendarBatchList',
|
|
199
199
|
});
|
|
200
200
|
BatchModel.belongsTo(academicCalendarModel_js_1.default, {
|
|
201
201
|
foreignKey: {
|
|
202
|
-
name:
|
|
203
|
-
field:
|
|
202
|
+
name: 'academicCalendarId',
|
|
203
|
+
field: 'academic_calendar_id',
|
|
204
204
|
allowNull: true,
|
|
205
205
|
},
|
|
206
|
-
as:
|
|
206
|
+
as: 'batchAcademicCalendar',
|
|
207
207
|
});
|
|
208
208
|
BatchModel.afterBulkCreate(async (instances, options) => {
|
|
209
209
|
for (const instance of instances) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Model } from
|
|
2
|
-
import { IDriverModelAttributes } from
|
|
3
|
-
import { TDriverModelCreationAttributes } from
|
|
4
|
-
import { APP_TYPE, COMMAN_STATUS } from
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IDriverModelAttributes } from '../../interfaces/driverInterface.js';
|
|
3
|
+
import { TDriverModelCreationAttributes } from '../../types/driverType.js';
|
|
4
|
+
import { APP_TYPE, COMMAN_STATUS } from '../../constants/app.js';
|
|
5
5
|
declare class DriverModel extends Model<IDriverModelAttributes, TDriverModelCreationAttributes> {
|
|
6
6
|
id: string;
|
|
7
7
|
instituteId: string;
|
|
@@ -25,16 +25,16 @@ DriverModel.init({
|
|
|
25
25
|
firstName: {
|
|
26
26
|
type: sequelize_1.DataTypes.STRING(25),
|
|
27
27
|
allowNull: false,
|
|
28
|
-
field:
|
|
28
|
+
field: 'first_name',
|
|
29
29
|
},
|
|
30
30
|
lastName: {
|
|
31
31
|
type: sequelize_1.DataTypes.STRING(25),
|
|
32
32
|
allowNull: false,
|
|
33
|
-
field:
|
|
33
|
+
field: 'last_name',
|
|
34
34
|
},
|
|
35
35
|
instituteId: {
|
|
36
36
|
type: sequelize_1.DataTypes.UUID,
|
|
37
|
-
field:
|
|
37
|
+
field: 'institute_id',
|
|
38
38
|
allowNull: true,
|
|
39
39
|
},
|
|
40
40
|
address1: {
|
|
@@ -48,7 +48,7 @@ DriverModel.init({
|
|
|
48
48
|
pinCode: {
|
|
49
49
|
type: sequelize_1.DataTypes.STRING,
|
|
50
50
|
allowNull: true,
|
|
51
|
-
field:
|
|
51
|
+
field: 'pin_code',
|
|
52
52
|
},
|
|
53
53
|
country: {
|
|
54
54
|
type: sequelize_1.DataTypes.INTEGER,
|
|
@@ -86,7 +86,7 @@ DriverModel.init({
|
|
|
86
86
|
type: sequelize_1.DataTypes.ENUM,
|
|
87
87
|
values: Object.values(app_js_1.APP_TYPE),
|
|
88
88
|
allowNull: true,
|
|
89
|
-
field:
|
|
89
|
+
field: 'app_type',
|
|
90
90
|
// defaultValue: APP_TYPE.SCHOOL_APP,
|
|
91
91
|
},
|
|
92
92
|
status: {
|
|
@@ -96,57 +96,57 @@ DriverModel.init({
|
|
|
96
96
|
defaultValue: app_js_1.COMMAN_STATUS.ACTIVE,
|
|
97
97
|
},
|
|
98
98
|
}, {
|
|
99
|
-
modelName:
|
|
100
|
-
tableName:
|
|
99
|
+
modelName: 'DriverModel',
|
|
100
|
+
tableName: 'drivers',
|
|
101
101
|
timestamps: true,
|
|
102
102
|
sequelize: index_js_1.sequelize,
|
|
103
103
|
});
|
|
104
104
|
// Associations
|
|
105
105
|
DriverModel.belongsTo(userModel_js_1.default, {
|
|
106
106
|
foreignKey: {
|
|
107
|
-
name:
|
|
107
|
+
name: 'createdBy',
|
|
108
108
|
allowNull: true,
|
|
109
|
-
field:
|
|
109
|
+
field: 'created_by',
|
|
110
110
|
},
|
|
111
|
-
as:
|
|
111
|
+
as: 'createdByUser',
|
|
112
112
|
});
|
|
113
113
|
DriverModel.belongsTo(userModel_js_1.default, {
|
|
114
114
|
foreignKey: {
|
|
115
|
-
name:
|
|
115
|
+
name: 'updatedBy',
|
|
116
116
|
allowNull: true,
|
|
117
|
-
field:
|
|
117
|
+
field: 'updated_by',
|
|
118
118
|
},
|
|
119
|
-
as:
|
|
119
|
+
as: 'updatedByUser',
|
|
120
120
|
});
|
|
121
121
|
DriverModel.belongsTo(userModel_js_1.default, {
|
|
122
122
|
foreignKey: {
|
|
123
|
-
name:
|
|
123
|
+
name: 'deletedBy',
|
|
124
124
|
allowNull: true,
|
|
125
|
-
field:
|
|
125
|
+
field: 'deleted_by',
|
|
126
126
|
},
|
|
127
|
-
as:
|
|
127
|
+
as: 'deletedByUser',
|
|
128
128
|
});
|
|
129
129
|
DriverModel.belongsTo(countryModel_js_1.default, {
|
|
130
|
-
foreignKey:
|
|
131
|
-
as:
|
|
130
|
+
foreignKey: 'country',
|
|
131
|
+
as: 'countryDetails',
|
|
132
132
|
});
|
|
133
|
-
DriverModel.belongsTo(stateModel_js_1.default, { foreignKey:
|
|
134
|
-
DriverModel.belongsTo(cityModel_js_1.default, { foreignKey:
|
|
133
|
+
DriverModel.belongsTo(stateModel_js_1.default, { foreignKey: 'state', as: 'stateDetails' });
|
|
134
|
+
DriverModel.belongsTo(cityModel_js_1.default, { foreignKey: 'city', as: 'cityDetails' });
|
|
135
135
|
DriverModel.belongsTo(fileStorageModel_js_1.default, {
|
|
136
|
-
foreignKey:
|
|
137
|
-
as:
|
|
136
|
+
foreignKey: 'drivingLicense',
|
|
137
|
+
as: 'drivingLicenseDetails',
|
|
138
138
|
});
|
|
139
139
|
DriverModel.belongsTo(fileStorageModel_js_1.default, {
|
|
140
|
-
foreignKey:
|
|
141
|
-
as:
|
|
140
|
+
foreignKey: 'aadharCard',
|
|
141
|
+
as: 'aadharCardDetails',
|
|
142
142
|
});
|
|
143
143
|
DriverModel.belongsTo(instituteModel_js_1.default, {
|
|
144
|
-
foreignKey:
|
|
145
|
-
as:
|
|
144
|
+
foreignKey: 'instituteId',
|
|
145
|
+
as: 'driverInstitute',
|
|
146
146
|
});
|
|
147
147
|
instituteModel_js_1.default.hasMany(DriverModel, {
|
|
148
|
-
foreignKey:
|
|
149
|
-
as:
|
|
148
|
+
foreignKey: 'instituteId',
|
|
149
|
+
as: 'instituteHasDrivers',
|
|
150
150
|
});
|
|
151
151
|
const beforeCreateOrUpdateHook = async (driver) => {
|
|
152
152
|
if (driver.instituteId) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Model } from
|
|
2
|
-
import { IFacilityAttributes } from
|
|
3
|
-
import { TFacilityCreationAttributes } from
|
|
4
|
-
import { FACILITY_TYPE } from
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IFacilityAttributes } from '../../interfaces/facilityInterface.js';
|
|
3
|
+
import { TFacilityCreationAttributes } from '../../types/facilityType.js';
|
|
4
|
+
import { FACILITY_TYPE } from '../../constants/app.js';
|
|
5
5
|
declare class FacilityModel extends Model<IFacilityAttributes, TFacilityCreationAttributes> {
|
|
6
6
|
id: string;
|
|
7
7
|
typeManagementId: string;
|
|
@@ -21,7 +21,7 @@ FacilityModel.init({
|
|
|
21
21
|
},
|
|
22
22
|
typeManagementId: {
|
|
23
23
|
type: sequelize_1.DataTypes.UUID,
|
|
24
|
-
field:
|
|
24
|
+
field: 'type_management_id',
|
|
25
25
|
allowNull: false,
|
|
26
26
|
},
|
|
27
27
|
quantity: {
|
|
@@ -36,12 +36,12 @@ FacilityModel.init({
|
|
|
36
36
|
},
|
|
37
37
|
instituteId: {
|
|
38
38
|
type: sequelize_1.DataTypes.UUID,
|
|
39
|
-
field:
|
|
39
|
+
field: 'institute_id',
|
|
40
40
|
allowNull: false,
|
|
41
41
|
},
|
|
42
42
|
}, {
|
|
43
|
-
modelName:
|
|
44
|
-
tableName:
|
|
43
|
+
modelName: 'FacilityModel',
|
|
44
|
+
tableName: 'facilities',
|
|
45
45
|
timestamps: true,
|
|
46
46
|
sequelize: index_js_1.sequelize,
|
|
47
47
|
});
|
|
@@ -73,48 +73,48 @@ FacilityModel.beforeBulkCreate(async (instances) => {
|
|
|
73
73
|
});
|
|
74
74
|
FacilityModel.belongsTo(instituteModel_js_1.default, {
|
|
75
75
|
foreignKey: {
|
|
76
|
-
name:
|
|
77
|
-
field:
|
|
76
|
+
name: 'instituteId',
|
|
77
|
+
field: 'institute_id',
|
|
78
78
|
},
|
|
79
|
-
as:
|
|
79
|
+
as: 'facilityInstitute',
|
|
80
80
|
});
|
|
81
81
|
instituteModel_js_1.default.hasMany(FacilityModel, {
|
|
82
|
-
foreignKey:
|
|
83
|
-
as:
|
|
82
|
+
foreignKey: 'instituteId',
|
|
83
|
+
as: 'instituteHasFacilities',
|
|
84
84
|
});
|
|
85
85
|
FacilityModel.belongsTo(typeManagementModel_js_1.default, {
|
|
86
86
|
foreignKey: {
|
|
87
|
-
name:
|
|
88
|
-
field:
|
|
87
|
+
name: 'typeManagementId',
|
|
88
|
+
field: 'type_management_id',
|
|
89
89
|
},
|
|
90
|
-
as:
|
|
90
|
+
as: 'facilityType',
|
|
91
91
|
});
|
|
92
92
|
typeManagementModel_js_1.default.hasMany(FacilityModel, {
|
|
93
|
-
foreignKey:
|
|
94
|
-
as:
|
|
93
|
+
foreignKey: 'typeManagementId',
|
|
94
|
+
as: 'instituteHasFacilitiesType',
|
|
95
95
|
});
|
|
96
96
|
FacilityModel.belongsTo(userModel_js_1.default, {
|
|
97
97
|
foreignKey: {
|
|
98
|
-
name:
|
|
98
|
+
name: 'createdBy',
|
|
99
99
|
allowNull: true,
|
|
100
|
-
field:
|
|
100
|
+
field: 'created_by',
|
|
101
101
|
},
|
|
102
|
-
as:
|
|
102
|
+
as: 'createdByUser',
|
|
103
103
|
});
|
|
104
104
|
FacilityModel.belongsTo(userModel_js_1.default, {
|
|
105
105
|
foreignKey: {
|
|
106
|
-
name:
|
|
106
|
+
name: 'updatedBy',
|
|
107
107
|
allowNull: true,
|
|
108
|
-
field:
|
|
108
|
+
field: 'updated_by',
|
|
109
109
|
},
|
|
110
|
-
as:
|
|
110
|
+
as: 'updatedByUser',
|
|
111
111
|
});
|
|
112
112
|
FacilityModel.belongsTo(userModel_js_1.default, {
|
|
113
113
|
foreignKey: {
|
|
114
|
-
name:
|
|
114
|
+
name: 'deletedBy',
|
|
115
115
|
allowNull: true,
|
|
116
|
-
field:
|
|
116
|
+
field: 'deleted_by',
|
|
117
117
|
},
|
|
118
|
-
as:
|
|
118
|
+
as: 'deletedByUser',
|
|
119
119
|
});
|
|
120
120
|
exports.default = FacilityModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Model } from
|
|
2
|
-
import { IFeeHistoryModelAttributes } from
|
|
3
|
-
import { TFeeHistoryModelCreationAttributes } from
|
|
4
|
-
import { FEE_HISTORY_STATUS, PAYMENT_TYPE } from
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IFeeHistoryModelAttributes } from '../../interfaces/feeHistoryInterface.js';
|
|
3
|
+
import { TFeeHistoryModelCreationAttributes } from '../../types/feeHistoryType.js';
|
|
4
|
+
import { FEE_HISTORY_STATUS, PAYMENT_TYPE } from '../../constants/app.js';
|
|
5
5
|
declare class FeeHistoryModel extends Model<IFeeHistoryModelAttributes, TFeeHistoryModelCreationAttributes> {
|
|
6
6
|
id: string;
|
|
7
7
|
instituteId: string;
|