@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.
- package/dist/db/psql/migrations/20251208112241-add-new-field.d.ts +2 -0
- package/dist/db/psql/migrations/20251208112241-add-new-field.js +21 -0
- package/dist/interfaces/feeReminderSettingInterface.d.ts +1 -0
- package/dist/models/psql/feeReminderSettingModel.d.ts +1 -0
- package/dist/models/psql/feeReminderSettingModel.js +9 -1
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -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