@kipicore/dbcore 1.1.123 → 1.1.124

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,21 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('fee_reminder_settings');
4
+ if (!table.academic_calendar_id) {
5
+ await queryInterface.addColumn('fee_reminder_settings', 'academic_calendar_id', {
6
+ type: Sequelize.UUID,
7
+ allowNull: true,
8
+ field: 'academic_calendar_id',
9
+ });
10
+ }
11
+ };
12
+ const down = async (queryInterface, Sequelize) => {
13
+ const table = await queryInterface.describeTable('fee_reminder_settings');
14
+ if (table.academic_calendar_id) {
15
+ await queryInterface.removeColumn('fee_reminder_settings', 'academic_calendar_id');
16
+ }
17
+ };
18
+ module.exports = {
19
+ up,
20
+ down,
21
+ };
@@ -7,4 +7,5 @@ export interface IFeeReminderSettingModelAttributes extends IDefaultAttributes {
7
7
  status: FEE_REMINDER_SETTING_STATUS;
8
8
  typeId: string;
9
9
  default: BOOLEAN_STATUS;
10
+ academicCalendarId?: string;
10
11
  }
@@ -9,6 +9,7 @@ declare class FeeReminderSettingModel extends Model<IFeeReminderSettingModelAttr
9
9
  status: FEE_REMINDER_SETTING_STATUS;
10
10
  typeId: string;
11
11
  default: BOOLEAN_STATUS;
12
+ academicCalendarId: string;
12
13
  createdBy: string;
13
14
  updatedBy: string;
14
15
  deletedBy: string;
@@ -5,7 +5,7 @@ const index_1 = require("./index");
5
5
  const app_1 = require("../../constants/app");
6
6
  class FeeReminderSettingModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { InstituteModel, UserModel } = models;
8
+ const { InstituteModel, UserModel, AcademicCalendarModel } = models;
9
9
  FeeReminderSettingModel.belongsTo(InstituteModel, {
10
10
  foreignKey: { name: 'instituteId', field: 'institute_id' },
11
11
  as: 'settingInstitute',
@@ -14,6 +14,14 @@ class FeeReminderSettingModel extends sequelize_1.Model {
14
14
  foreignKey: 'instituteId',
15
15
  as: 'instituteReminderSettings',
16
16
  });
17
+ FeeReminderSettingModel.belongsTo(AcademicCalendarModel, {
18
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
19
+ as: 'settingAcademic',
20
+ });
21
+ AcademicCalendarModel.hasMany(FeeReminderSettingModel, {
22
+ foreignKey: 'academicCalendarId',
23
+ as: 'academicReminderSettings',
24
+ });
17
25
  FeeReminderSettingModel.belongsTo(UserModel, {
18
26
  foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
19
27
  as: 'createdByUser',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.123",
3
+ "version": "1.1.124",
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",