@kipicore/dbcore 1.1.637 → 1.1.638
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/dist/db/psql/migrations/20260708000000-add-batch-id-to-class-room-collection.d.ts +2 -0
- package/dist/db/psql/migrations/20260708000000-add-batch-id-to-class-room-collection.js +18 -0
- package/dist/interfaces/classRoomCollectionInterface.d.ts +1 -0
- package/dist/models/psql/classRoomCollectionModel.d.ts +1 -0
- package/dist/models/psql/classRoomCollectionModel.js +22 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
up: async (queryInterface, Sequelize) => {
|
|
4
|
+
const tableInfo = await queryInterface.describeTable('class_room_collection');
|
|
5
|
+
if (!tableInfo.batch_id) {
|
|
6
|
+
await queryInterface.addColumn('class_room_collection', 'batch_id', {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
down: async (queryInterface, Sequelize) => {
|
|
13
|
+
const tableInfo = await queryInterface.describeTable('class_room_collection');
|
|
14
|
+
if (tableInfo.batch_id) {
|
|
15
|
+
await queryInterface.removeColumn('class_room_collection', 'batch_id');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -5,7 +5,7 @@ const index_1 = require("./index");
|
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
class ClassRoomCollectionModel extends sequelize_1.Model {
|
|
7
7
|
static associate(models) {
|
|
8
|
-
const { UserModel, InstituteModel, AcademicCalendarModel, ClassRoomEventModel } = models;
|
|
8
|
+
const { UserModel, InstituteModel, AcademicCalendarModel, ClassRoomEventModel, BatchModel } = models;
|
|
9
9
|
ClassRoomCollectionModel.belongsTo(UserModel, {
|
|
10
10
|
foreignKey: {
|
|
11
11
|
name: 'createdBy',
|
|
@@ -106,6 +106,22 @@ class ClassRoomCollectionModel extends sequelize_1.Model {
|
|
|
106
106
|
},
|
|
107
107
|
as: 'classEventClassRCol',
|
|
108
108
|
});
|
|
109
|
+
ClassRoomCollectionModel.belongsTo(BatchModel, {
|
|
110
|
+
foreignKey: {
|
|
111
|
+
name: 'batchId',
|
|
112
|
+
allowNull: true,
|
|
113
|
+
field: 'batch_id',
|
|
114
|
+
},
|
|
115
|
+
as: 'classRColBatch',
|
|
116
|
+
});
|
|
117
|
+
BatchModel.hasMany(ClassRoomCollectionModel, {
|
|
118
|
+
foreignKey: {
|
|
119
|
+
name: 'batchId',
|
|
120
|
+
allowNull: true,
|
|
121
|
+
field: 'batch_id',
|
|
122
|
+
},
|
|
123
|
+
as: 'batchClassRCol',
|
|
124
|
+
});
|
|
109
125
|
}
|
|
110
126
|
}
|
|
111
127
|
ClassRoomCollectionModel.init({
|
|
@@ -154,6 +170,11 @@ ClassRoomCollectionModel.init({
|
|
|
154
170
|
field: 'class_room_event_id',
|
|
155
171
|
allowNull: true,
|
|
156
172
|
},
|
|
173
|
+
batchId: {
|
|
174
|
+
type: sequelize_1.DataTypes.UUID,
|
|
175
|
+
field: 'batch_id',
|
|
176
|
+
allowNull: true,
|
|
177
|
+
},
|
|
157
178
|
paidDate: {
|
|
158
179
|
type: sequelize_1.DataTypes.DATE,
|
|
159
180
|
field: 'paid_date',
|
package/package.json
CHANGED