@kipicore/dbcore 1.1.636 → 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.
@@ -1252,7 +1252,7 @@ export declare enum PAYMENT_STATUS {
1252
1252
  PAID = "PAID",
1253
1253
  UNPAID = "UNPAID",
1254
1254
  PENDING = "PENDING",
1255
- PENDING_REFUND = "PENDING REFUND",
1255
+ PENDING_REFUND = "PENDING_REFUND",
1256
1256
  REFUND = "REFUND"
1257
1257
  }
1258
1258
  export declare enum COMPETITION_EVENTS {
@@ -1514,7 +1514,7 @@ var PAYMENT_STATUS;
1514
1514
  PAYMENT_STATUS["PAID"] = "PAID";
1515
1515
  PAYMENT_STATUS["UNPAID"] = "UNPAID";
1516
1516
  PAYMENT_STATUS["PENDING"] = "PENDING";
1517
- PAYMENT_STATUS["PENDING_REFUND"] = "PENDING REFUND";
1517
+ PAYMENT_STATUS["PENDING_REFUND"] = "PENDING_REFUND";
1518
1518
  PAYMENT_STATUS["REFUND"] = "REFUND";
1519
1519
  })(PAYMENT_STATUS || (exports.PAYMENT_STATUS = PAYMENT_STATUS = {}));
1520
1520
  var COMPETITION_EVENTS;
@@ -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.636",
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",