@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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -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
+ };
@@ -8,6 +8,7 @@ export interface IClassRoomCollectionModelAttributes extends IDefaultAttributes
8
8
  collectorId: string;
9
9
  paymentMethod: PAYMENT_TYPE;
10
10
  userId?: string;
11
+ batchId?: string;
11
12
  amount: number;
12
13
  status: PAYMENT_STATUS;
13
14
  paidDate: Date;
@@ -13,6 +13,7 @@ declare class ClassRoomCollectionModel extends Model<IClassRoomCollectionModelAt
13
13
  classRoomEventId: string;
14
14
  paymentMethod: PAYMENT_TYPE;
15
15
  academicCalendarId?: string;
16
+ batchId?: string;
16
17
  createdBy: string;
17
18
  updatedBy: string;
18
19
  deletedBy: string;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.637",
3
+ "version": "1.1.638",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",