@kipicore/dbcore 1.1.215 → 1.1.217
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/models/mongodb/schoolFee1Model.js +2 -2
- package/dist/models/psql/studentFeeCollectionModel.d.ts +0 -1
- package/dist/models/psql/studentFeeCollectionModel.js +22 -22
- package/dist/models/psql/studentFeeHistoryModel.js +3 -3
- package/dist/models/psql/studentFeeTermsModel.js +3 -3
- package/dist/models/psql/studentFeeTypeCollectionModel.js +3 -3
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ const app_1 = require("../../constants/app");
|
|
|
41
41
|
const errorMessages_1 = require("../../constants/errorMessages");
|
|
42
42
|
const instituteModel_1 = __importDefault(require("../psql/instituteModel"));
|
|
43
43
|
const userInstituteMetaModel_1 = __importDefault(require("./userInstituteMetaModel"));
|
|
44
|
-
const
|
|
44
|
+
const feeType1Model_1 = __importDefault(require("../psql/feeType1Model"));
|
|
45
45
|
const termsSchema = new mongoose_1.Schema({
|
|
46
46
|
date: {
|
|
47
47
|
type: Date,
|
|
@@ -199,7 +199,7 @@ schoolFee1Schema.pre('save', async function (next) {
|
|
|
199
199
|
// };
|
|
200
200
|
for (const fee of schoolFee1.fees) {
|
|
201
201
|
if (fee.feeTypeId) {
|
|
202
|
-
const feeType = await
|
|
202
|
+
const feeType = await feeType1Model_1.default.findByPk(fee.feeTypeId);
|
|
203
203
|
if (!feeType)
|
|
204
204
|
return next(new Error(errorMessages_1.FEE_TYPE_ERROR_MESSAGES.NOT_FOUND));
|
|
205
205
|
}
|
|
@@ -25,7 +25,6 @@ declare class StudentFeeCollectionModel extends Model<IStudentFeeCollectionModel
|
|
|
25
25
|
readonly createdAt: Date;
|
|
26
26
|
readonly deletedAt: string;
|
|
27
27
|
readonly updatedAt: Date;
|
|
28
|
-
static addHooks(models: any): void;
|
|
29
28
|
static associate(models: any): void;
|
|
30
29
|
}
|
|
31
30
|
export default StudentFeeCollectionModel;
|
|
@@ -4,20 +4,20 @@ const sequelize_1 = require("sequelize");
|
|
|
4
4
|
const index_1 = require("./index");
|
|
5
5
|
const app_1 = require("../../constants/app");
|
|
6
6
|
class StudentFeeCollectionModel extends sequelize_1.Model {
|
|
7
|
-
static addHooks(models) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
7
|
+
// static addHooks(models: any) {
|
|
8
|
+
// const beforeCreateOrUpdateHook = async (feeCollection: StudentFeeCollectionModel): Promise<void> => {
|
|
9
|
+
// // if need write logic for validate fee
|
|
10
|
+
// };
|
|
11
|
+
// StudentFeeCollectionModel.beforeBulkCreate(async instances => {
|
|
12
|
+
// for (const instance of instances) {
|
|
13
|
+
// await beforeCreateOrUpdateHook(instance);
|
|
14
|
+
// }
|
|
15
|
+
// });
|
|
16
|
+
// StudentFeeCollectionModel.beforeCreate(beforeCreateOrUpdateHook);
|
|
17
|
+
// StudentFeeCollectionModel.beforeBulkUpdate(async (options: UpdateOptions) => {
|
|
18
|
+
// await beforeCreateOrUpdateHook(options.attributes as StudentFeeCollectionModel);
|
|
19
|
+
// });
|
|
20
|
+
// }
|
|
21
21
|
static associate(models) {
|
|
22
22
|
const { InstituteModel, UserModel, AcademicCalendarModel } = models;
|
|
23
23
|
StudentFeeCollectionModel.belongsTo(InstituteModel, {
|
|
@@ -44,14 +44,14 @@ class StudentFeeCollectionModel extends sequelize_1.Model {
|
|
|
44
44
|
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id', allowNull: true },
|
|
45
45
|
as: 'collectionHasCalendar',
|
|
46
46
|
});
|
|
47
|
-
StudentFeeCollectionModel.belongsTo(StudentFeeCollectionModel, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
StudentFeeCollectionModel.hasMany(StudentFeeCollectionModel, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
47
|
+
// StudentFeeCollectionModel.belongsTo(StudentFeeCollectionModel, {
|
|
48
|
+
// foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
49
|
+
// as: 'oldCollection',
|
|
50
|
+
// });
|
|
51
|
+
// StudentFeeCollectionModel.hasMany(StudentFeeCollectionModel, {
|
|
52
|
+
// foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
53
|
+
// as: 'collectionHasOldCollection',
|
|
54
|
+
// });
|
|
55
55
|
StudentFeeCollectionModel.belongsTo(UserModel, {
|
|
56
56
|
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
57
57
|
as: 'createdByUser',
|
|
@@ -6,7 +6,7 @@ const index_1 = require("./index");
|
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
7
|
class StudentFeeHistoryModel extends sequelize_1.Model {
|
|
8
8
|
static associate(models) {
|
|
9
|
-
const { UserModel, InstituteModel, StudentFeeCollectionModel, FileStorageModel, BankAccountDetailsModel, AcademicCalendarModel,
|
|
9
|
+
const { UserModel, InstituteModel, StudentFeeCollectionModel, FileStorageModel, BankAccountDetailsModel, AcademicCalendarModel, FeeType1Model, BatchModel, InstituteEntityModel, } = models;
|
|
10
10
|
StudentFeeHistoryModel.belongsTo(StudentFeeCollectionModel, {
|
|
11
11
|
foreignKey: { name: 'studentFeeCollectionId', field: 'student_fee_collection_id', allowNull: true },
|
|
12
12
|
as: 'feeHistoryCollection',
|
|
@@ -63,11 +63,11 @@ class StudentFeeHistoryModel extends sequelize_1.Model {
|
|
|
63
63
|
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
64
64
|
as: 'acaCalStudentFeeHistory',
|
|
65
65
|
});
|
|
66
|
-
StudentFeeHistoryModel.belongsTo(
|
|
66
|
+
StudentFeeHistoryModel.belongsTo(FeeType1Model, {
|
|
67
67
|
foreignKey: { name: 'feeTypeId', field: 'feeType_id' },
|
|
68
68
|
as: 'studentFeeHistoryFeeType',
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
FeeType1Model.hasMany(StudentFeeHistoryModel, {
|
|
71
71
|
foreignKey: { name: 'feeTypeId', field: 'feeType_id' },
|
|
72
72
|
as: 'feeTypeStudentFeeHistory',
|
|
73
73
|
});
|
|
@@ -5,7 +5,7 @@ const sequelize_1 = require("sequelize");
|
|
|
5
5
|
const index_1 = require("./index");
|
|
6
6
|
class StudentFeeTermsModel extends sequelize_1.Model {
|
|
7
7
|
static associate(models) {
|
|
8
|
-
const { UserModel, InstituteModel, AcademicCalendarModel,
|
|
8
|
+
const { UserModel, InstituteModel, AcademicCalendarModel, FeeType1Model, InstituteEntityModel, SchoolFeeCollectionModel } = models;
|
|
9
9
|
StudentFeeTermsModel.belongsTo(StudentFeeTermsModel, {
|
|
10
10
|
foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
11
11
|
as: 'studentOldFeeTerms',
|
|
@@ -14,11 +14,11 @@ class StudentFeeTermsModel extends sequelize_1.Model {
|
|
|
14
14
|
foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
|
|
15
15
|
as: 'studentTermsHasOldTerms',
|
|
16
16
|
});
|
|
17
|
-
StudentFeeTermsModel.belongsTo(
|
|
17
|
+
StudentFeeTermsModel.belongsTo(FeeType1Model, {
|
|
18
18
|
foreignKey: { name: 'feeTypeId', field: 'fee_type_id', allowNull: true },
|
|
19
19
|
as: 'studentFeeTermsFeeType',
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
FeeType1Model.hasMany(StudentFeeTermsModel, {
|
|
22
22
|
foreignKey: { name: 'feeTypeId', field: 'fee_type_id', allowNull: true },
|
|
23
23
|
as: 'studentTermsHasFeeType',
|
|
24
24
|
});
|
|
@@ -6,7 +6,7 @@ const index_1 = require("./index");
|
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
7
|
class StudentFeeTypeCollectionModel extends sequelize_1.Model {
|
|
8
8
|
static associate(models) {
|
|
9
|
-
const { UserModel, InstituteModel, StudentFeeCollectionModel, AcademicCalendarModel,
|
|
9
|
+
const { UserModel, InstituteModel, StudentFeeCollectionModel, AcademicCalendarModel, FeeType1Model, InstituteEntityModel, BatchModel } = models;
|
|
10
10
|
StudentFeeTypeCollectionModel.belongsTo(StudentFeeCollectionModel, {
|
|
11
11
|
foreignKey: { name: 'studentFeeCollectionId', field: 'student_fee_collection_id', allowNull: true },
|
|
12
12
|
as: 'feeTypeCollection',
|
|
@@ -63,13 +63,13 @@ class StudentFeeTypeCollectionModel extends sequelize_1.Model {
|
|
|
63
63
|
foreignKey: { name: 'batchId', field: 'batch_id' },
|
|
64
64
|
as: 'batchFeeTypeCollection',
|
|
65
65
|
});
|
|
66
|
-
StudentFeeTypeCollectionModel.belongsTo(
|
|
66
|
+
StudentFeeTypeCollectionModel.belongsTo(FeeType1Model, {
|
|
67
67
|
foreignKey: {
|
|
68
68
|
name: 'feeTypeId',
|
|
69
69
|
},
|
|
70
70
|
as: 'feeTypeCollectionFeeType',
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
FeeType1Model.hasMany(StudentFeeTypeCollectionModel, {
|
|
73
73
|
foreignKey: 'feeTypeId',
|
|
74
74
|
as: 'feeTypeHasTypeCollection',
|
|
75
75
|
});
|
package/package.json
CHANGED