@kipicore/dbcore 1.1.221 → 1.1.223
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/20260121054041-add_feeTypeModel1_update1.d.ts +2 -0
- package/dist/db/psql/migrations/20260121054041-add_feeTypeModel1_update1.js +191 -0
- package/dist/interfaces/feeType1Interface.d.ts +1 -1
- package/dist/models/psql/feeType1Model.d.ts +1 -1
- package/dist/models/psql/feeType1Model.js +2 -2
- package/dist/models/psql/schoolFeeTermsModel.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const tableName = 'fee_type1';
|
|
4
|
+
const tableExists = await queryInterface
|
|
5
|
+
.describeTable(tableName)
|
|
6
|
+
.then(() => true)
|
|
7
|
+
.catch(() => false);
|
|
8
|
+
if (!tableExists) {
|
|
9
|
+
await queryInterface.createTable(tableName, {
|
|
10
|
+
id: {
|
|
11
|
+
type: Sequelize.UUID,
|
|
12
|
+
defaultValue: Sequelize.UUIDV4,
|
|
13
|
+
allowNull: false,
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
},
|
|
16
|
+
typeManagementId: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
field: 'type_management_id',
|
|
20
|
+
},
|
|
21
|
+
instituteId: {
|
|
22
|
+
type: Sequelize.UUID,
|
|
23
|
+
allowNull: true,
|
|
24
|
+
field: 'institute_id',
|
|
25
|
+
},
|
|
26
|
+
account: {
|
|
27
|
+
type: Sequelize.ARRAY(Sequelize.UUID),
|
|
28
|
+
allowNull: true,
|
|
29
|
+
defaultValue: [],
|
|
30
|
+
},
|
|
31
|
+
status: {
|
|
32
|
+
type: Sequelize.STRING,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
},
|
|
35
|
+
module: {
|
|
36
|
+
type: Sequelize.STRING,
|
|
37
|
+
allowNull: true,
|
|
38
|
+
},
|
|
39
|
+
isDefault: {
|
|
40
|
+
type: Sequelize.STRING,
|
|
41
|
+
allowNull: true,
|
|
42
|
+
field: 'is_default',
|
|
43
|
+
},
|
|
44
|
+
isCreditAllowed: {
|
|
45
|
+
type: Sequelize.BOOLEAN,
|
|
46
|
+
allowNull: true,
|
|
47
|
+
field: 'is_credit_allowed',
|
|
48
|
+
defaultValue: false,
|
|
49
|
+
},
|
|
50
|
+
isRefundable: {
|
|
51
|
+
type: Sequelize.BOOLEAN,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
field: 'is_refundable',
|
|
54
|
+
defaultValue: false,
|
|
55
|
+
},
|
|
56
|
+
isRequired: {
|
|
57
|
+
type: Sequelize.BOOLEAN,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
field: 'is_required',
|
|
60
|
+
defaultValue: false,
|
|
61
|
+
},
|
|
62
|
+
isTaxable: {
|
|
63
|
+
type: Sequelize.BOOLEAN,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
field: 'is_taxable',
|
|
66
|
+
defaultValue: false,
|
|
67
|
+
},
|
|
68
|
+
defaultAccount: {
|
|
69
|
+
type: Sequelize.UUID,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
field: 'default_account',
|
|
72
|
+
},
|
|
73
|
+
feeType: {
|
|
74
|
+
type: Sequelize.STRING,
|
|
75
|
+
allowNull: true,
|
|
76
|
+
field: 'fee_type',
|
|
77
|
+
},
|
|
78
|
+
frequency: {
|
|
79
|
+
type: Sequelize.STRING,
|
|
80
|
+
allowNull: true,
|
|
81
|
+
},
|
|
82
|
+
academicCalendarId: {
|
|
83
|
+
type: Sequelize.UUID,
|
|
84
|
+
allowNull: true,
|
|
85
|
+
field: 'academic_calendar_id',
|
|
86
|
+
},
|
|
87
|
+
createdAt: {
|
|
88
|
+
type: Sequelize.DATE,
|
|
89
|
+
allowNull: false,
|
|
90
|
+
defaultValue: Sequelize.NOW,
|
|
91
|
+
field: 'created_at',
|
|
92
|
+
},
|
|
93
|
+
updatedAt: {
|
|
94
|
+
type: Sequelize.DATE,
|
|
95
|
+
allowNull: false,
|
|
96
|
+
defaultValue: Sequelize.NOW,
|
|
97
|
+
field: 'updated_at',
|
|
98
|
+
},
|
|
99
|
+
deletedAt: {
|
|
100
|
+
type: Sequelize.DATE,
|
|
101
|
+
allowNull: true,
|
|
102
|
+
field: 'deleted_at',
|
|
103
|
+
},
|
|
104
|
+
createdBy: {
|
|
105
|
+
type: Sequelize.UUID,
|
|
106
|
+
allowNull: true,
|
|
107
|
+
field: 'created_by',
|
|
108
|
+
},
|
|
109
|
+
updatedBy: {
|
|
110
|
+
type: Sequelize.UUID,
|
|
111
|
+
allowNull: true,
|
|
112
|
+
field: 'updated_by',
|
|
113
|
+
},
|
|
114
|
+
deletedBy: {
|
|
115
|
+
type: Sequelize.UUID,
|
|
116
|
+
allowNull: true,
|
|
117
|
+
field: 'deleted_by',
|
|
118
|
+
},
|
|
119
|
+
paymentMethods: {
|
|
120
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
121
|
+
allowNull: true,
|
|
122
|
+
field: 'payment_methods',
|
|
123
|
+
defaultValue: [],
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const tableDefinition = await queryInterface.describeTable(tableName);
|
|
129
|
+
const columnsToAdd = {
|
|
130
|
+
typeManagementId: { type: Sequelize.UUID, allowNull: true, field: 'type_management_id' },
|
|
131
|
+
instituteId: { type: Sequelize.UUID, allowNull: true, field: 'institute_id' },
|
|
132
|
+
account: { type: Sequelize.ARRAY(Sequelize.UUID), allowNull: true, defaultValue: [] },
|
|
133
|
+
status: { type: Sequelize.STRING, allowNull: true },
|
|
134
|
+
module: { type: Sequelize.STRING, allowNull: true },
|
|
135
|
+
isDefault: { type: Sequelize.STRING, allowNull: true, field: 'is_default' },
|
|
136
|
+
isCreditAllowed: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_credit_allowed', defaultValue: false },
|
|
137
|
+
isRefundable: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_refundable', defaultValue: false },
|
|
138
|
+
isRequired: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_required', defaultValue: false },
|
|
139
|
+
isTaxable: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_taxable', defaultValue: false },
|
|
140
|
+
defaultAccount: { type: Sequelize.UUID, allowNull: true, field: 'default_account' },
|
|
141
|
+
feeType: { type: Sequelize.STRING, allowNull: true, field: 'fee_type' },
|
|
142
|
+
frequency: { type: Sequelize.STRING, allowNull: true },
|
|
143
|
+
academicCalendarId: { type: Sequelize.UUID, allowNull: true, field: 'academic_calendar_id' },
|
|
144
|
+
createdAt: { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW, field: 'created_at' },
|
|
145
|
+
updatedAt: { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW, field: 'updated_at' },
|
|
146
|
+
deletedAt: { type: Sequelize.DATE, allowNull: true, field: 'deleted_at' },
|
|
147
|
+
createdBy: {
|
|
148
|
+
type: Sequelize.UUID,
|
|
149
|
+
allowNull: true,
|
|
150
|
+
field: 'created_by',
|
|
151
|
+
},
|
|
152
|
+
updatedBy: {
|
|
153
|
+
type: Sequelize.UUID,
|
|
154
|
+
allowNull: true,
|
|
155
|
+
field: 'updated_by',
|
|
156
|
+
},
|
|
157
|
+
deletedBy: {
|
|
158
|
+
type: Sequelize.UUID,
|
|
159
|
+
allowNull: true,
|
|
160
|
+
field: 'deleted_by',
|
|
161
|
+
},
|
|
162
|
+
paymentMethods: {
|
|
163
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
164
|
+
allowNull: true,
|
|
165
|
+
field: 'payment_methods',
|
|
166
|
+
defaultValue: [],
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
for (const key of Object.keys(columnsToAdd)) {
|
|
170
|
+
const column = columnsToAdd[key];
|
|
171
|
+
const columnName = column.field || key;
|
|
172
|
+
if (!tableDefinition[columnName]) {
|
|
173
|
+
await queryInterface.addColumn(tableName, columnName, column);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const down = async (queryInterface) => {
|
|
179
|
+
const tableName = 'fee_type1';
|
|
180
|
+
const tableExists = await queryInterface
|
|
181
|
+
.describeTable(tableName)
|
|
182
|
+
.then(() => true)
|
|
183
|
+
.catch(() => false);
|
|
184
|
+
if (tableExists) {
|
|
185
|
+
await queryInterface.dropTable(tableName);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
module.exports = {
|
|
189
|
+
up,
|
|
190
|
+
down,
|
|
191
|
+
};
|
|
@@ -11,7 +11,7 @@ declare class FeeType1Model extends Model<IFeeType1ModelAttributes, TFeeType1Mod
|
|
|
11
11
|
module: COMMAN_STATUS;
|
|
12
12
|
status: COMMAN_STATUS;
|
|
13
13
|
account: string[];
|
|
14
|
-
|
|
14
|
+
paymentMethods: string[];
|
|
15
15
|
isDefault: BOOLEAN_STATUS;
|
|
16
16
|
academicCalendarId: string;
|
|
17
17
|
isCreditAllowed: boolean;
|
|
@@ -133,10 +133,10 @@ FeeType1Model.init({
|
|
|
133
133
|
field: 'academic_calendar_id',
|
|
134
134
|
allowNull: true,
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
paymentMethods: {
|
|
137
137
|
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
|
|
138
138
|
allowNull: true,
|
|
139
|
-
field: '
|
|
139
|
+
field: 'payment_methods',
|
|
140
140
|
defaultValue: [],
|
|
141
141
|
},
|
|
142
142
|
}, {
|
|
@@ -5,7 +5,7 @@ const sequelize_1 = require("sequelize");
|
|
|
5
5
|
const index_1 = require("./index");
|
|
6
6
|
class SchoolFeeTermsModel extends sequelize_1.Model {
|
|
7
7
|
static associate(models) {
|
|
8
|
-
const { UserModel, InstituteModel, AcademicCalendarModel,
|
|
8
|
+
const { UserModel, InstituteModel, AcademicCalendarModel, FeeType1Model, InstituteEntityModel } = models;
|
|
9
9
|
SchoolFeeTermsModel.belongsTo(SchoolFeeTermsModel, {
|
|
10
10
|
foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
11
11
|
as: 'schoolOldFeeTerms',
|
|
@@ -14,11 +14,11 @@ class SchoolFeeTermsModel extends sequelize_1.Model {
|
|
|
14
14
|
foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
15
15
|
as: 'schoolTermsHasOldTerms',
|
|
16
16
|
});
|
|
17
|
-
SchoolFeeTermsModel.belongsTo(
|
|
17
|
+
SchoolFeeTermsModel.belongsTo(FeeType1Model, {
|
|
18
18
|
foreignKey: { name: 'feeTypeId', field: 'fee_type_id', allowNull: true },
|
|
19
19
|
as: 'feeTermsFeeType',
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
FeeType1Model.hasMany(SchoolFeeTermsModel, {
|
|
22
22
|
foreignKey: { name: 'feeTypeId', field: 'fee_type_id', allowNull: true },
|
|
23
23
|
as: 'schoolTermsHasFeeType',
|
|
24
24
|
});
|
package/package.json
CHANGED