@kipicore/dbcore 1.1.475 → 1.1.476
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/20260425000004-create_payout_transaction_histories.js +12 -0
- package/dist/db/psql/migrations/20260425000007-add_academic_calendar_id_to_user_payouts.d.ts +2 -0
- package/dist/db/psql/migrations/20260425000007-add_academic_calendar_id_to_user_payouts.js +28 -0
- package/dist/interfaces/payoutTransactionHistoryInterface.d.ts +3 -0
- package/dist/interfaces/userPayoutInterface.d.ts +1 -0
- package/dist/models/psql/loanEmiModel.js +5 -1
- package/dist/models/psql/payoutTransactionHistoryModel.d.ts +3 -0
- package/dist/models/psql/payoutTransactionHistoryModel.js +24 -1
- package/dist/models/psql/userLoanModel.js +5 -1
- package/dist/models/psql/userPayoutModel.d.ts +1 -0
- package/dist/models/psql/userPayoutModel.js +5 -0
- package/package.json +1 -1
|
@@ -25,6 +25,10 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
25
25
|
type: Sequelize.UUID,
|
|
26
26
|
allowNull: true,
|
|
27
27
|
},
|
|
28
|
+
user_payout_id: {
|
|
29
|
+
type: Sequelize.UUID,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
},
|
|
28
32
|
total_amount: {
|
|
29
33
|
type: Sequelize.FLOAT,
|
|
30
34
|
allowNull: true,
|
|
@@ -40,6 +44,14 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
40
44
|
allowNull: true,
|
|
41
45
|
defaultValue: [],
|
|
42
46
|
},
|
|
47
|
+
paid_date: {
|
|
48
|
+
type: Sequelize.DATE,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
},
|
|
51
|
+
payout_date: {
|
|
52
|
+
type: Sequelize.DATE,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
},
|
|
43
55
|
status: {
|
|
44
56
|
type: Sequelize.STRING,
|
|
45
57
|
allowNull: true,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
up: async (queryInterface, Sequelize) => {
|
|
4
|
+
const transaction = await queryInterface.sequelize.transaction();
|
|
5
|
+
try {
|
|
6
|
+
await queryInterface.addColumn('user_payouts', 'academic_calendar_id', {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
}, { transaction });
|
|
10
|
+
await transaction.commit();
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
await transaction.rollback();
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
down: async (queryInterface) => {
|
|
18
|
+
const transaction = await queryInterface.sequelize.transaction();
|
|
19
|
+
try {
|
|
20
|
+
await queryInterface.removeColumn('user_payouts', 'academic_calendar_id', { transaction });
|
|
21
|
+
await transaction.commit();
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
await transaction.rollback();
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -4,9 +4,12 @@ export interface IPayoutTransactionHistoryModelAttributes {
|
|
|
4
4
|
userId: string;
|
|
5
5
|
instituteId: string;
|
|
6
6
|
academicCalendarId: string;
|
|
7
|
+
userPayoutId: string;
|
|
7
8
|
totalAmount: number;
|
|
8
9
|
payableAmount: number;
|
|
9
10
|
additionalPayoutIds: string[];
|
|
11
|
+
paidDate?: Date;
|
|
12
|
+
payoutDate?: string;
|
|
10
13
|
status?: PAYOUT_STATUS;
|
|
11
14
|
createdBy?: string;
|
|
12
15
|
updatedBy?: string;
|
|
@@ -21,9 +21,13 @@ class LoanEmiModel extends sequelize_1.Model {
|
|
|
21
21
|
foreignKey: { name: 'userLoanId', field: 'user_loan_id' },
|
|
22
22
|
as: 'userLoan',
|
|
23
23
|
});
|
|
24
|
+
UserLoanModel.hasMany(LoanEmiModel, {
|
|
25
|
+
foreignKey: { name: 'userLoanId', field: 'user_loan_id' },
|
|
26
|
+
as: 'loanEmiList',
|
|
27
|
+
});
|
|
24
28
|
LoanEmiModel.belongsTo(AcademicCalendarModel, {
|
|
25
29
|
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
26
|
-
as: '
|
|
30
|
+
as: 'loanAcademicCalendar',
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -7,9 +7,12 @@ declare class PayoutTransactionHistoryModel extends Model<IPayoutTransactionHist
|
|
|
7
7
|
userId: string;
|
|
8
8
|
instituteId: string;
|
|
9
9
|
academicCalendarId: string;
|
|
10
|
+
userPayoutId: string;
|
|
10
11
|
totalAmount: number;
|
|
11
12
|
payableAmount: number;
|
|
12
13
|
additionalPayoutIds: string[];
|
|
14
|
+
paidDate: Date;
|
|
15
|
+
payoutDate: Date;
|
|
13
16
|
status: PAYOUT_STATUS;
|
|
14
17
|
createdBy: string;
|
|
15
18
|
updatedBy: string;
|
|
@@ -4,7 +4,7 @@ const sequelize_1 = require("sequelize");
|
|
|
4
4
|
const index_1 = require("./index");
|
|
5
5
|
class PayoutTransactionHistoryModel extends sequelize_1.Model {
|
|
6
6
|
static associate(models) {
|
|
7
|
-
const { UserModel, InstituteModel, AcademicCalendarModel } = models;
|
|
7
|
+
const { UserModel, InstituteModel, AcademicCalendarModel, UserPayoutModel } = models;
|
|
8
8
|
PayoutTransactionHistoryModel.belongsTo(UserModel, {
|
|
9
9
|
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
10
|
as: 'createdByUser',
|
|
@@ -29,6 +29,14 @@ class PayoutTransactionHistoryModel extends sequelize_1.Model {
|
|
|
29
29
|
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
30
30
|
as: 'academicCalendar',
|
|
31
31
|
});
|
|
32
|
+
PayoutTransactionHistoryModel.belongsTo(UserPayoutModel, {
|
|
33
|
+
foreignKey: { name: 'userPayoutId', field: 'user_payout_id' },
|
|
34
|
+
as: 'userPayout',
|
|
35
|
+
});
|
|
36
|
+
UserPayoutModel.hasMany(PayoutTransactionHistoryModel, {
|
|
37
|
+
foreignKey: { name: 'userPayoutId', field: 'user_payout_id' },
|
|
38
|
+
as: 'userPayoutHistoryList',
|
|
39
|
+
});
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
PayoutTransactionHistoryModel.init({
|
|
@@ -53,6 +61,11 @@ PayoutTransactionHistoryModel.init({
|
|
|
53
61
|
allowNull: true,
|
|
54
62
|
field: 'academic_calendar_id',
|
|
55
63
|
},
|
|
64
|
+
userPayoutId: {
|
|
65
|
+
type: sequelize_1.DataTypes.UUID,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
field: 'user_payout_id',
|
|
68
|
+
},
|
|
56
69
|
totalAmount: {
|
|
57
70
|
type: sequelize_1.DataTypes.FLOAT,
|
|
58
71
|
allowNull: true,
|
|
@@ -71,6 +84,16 @@ PayoutTransactionHistoryModel.init({
|
|
|
71
84
|
defaultValue: [],
|
|
72
85
|
field: 'additional_payout_ids',
|
|
73
86
|
},
|
|
87
|
+
paidDate: {
|
|
88
|
+
type: sequelize_1.DataTypes.DATE,
|
|
89
|
+
allowNull: true,
|
|
90
|
+
field: 'paid_date',
|
|
91
|
+
},
|
|
92
|
+
payoutDate: {
|
|
93
|
+
type: sequelize_1.DataTypes.DATE,
|
|
94
|
+
allowNull: true,
|
|
95
|
+
field: 'payout_date',
|
|
96
|
+
},
|
|
74
97
|
status: {
|
|
75
98
|
type: sequelize_1.DataTypes.STRING,
|
|
76
99
|
allowNull: true,
|
|
@@ -31,7 +31,11 @@ class UserLoanModel extends sequelize_1.Model {
|
|
|
31
31
|
});
|
|
32
32
|
UserLoanModel.belongsTo(UserModel, {
|
|
33
33
|
foreignKey: { name: 'userId', field: 'user_id' },
|
|
34
|
-
as: '
|
|
34
|
+
as: 'loanUser',
|
|
35
|
+
});
|
|
36
|
+
UserModel.hasMany(UserLoanModel, {
|
|
37
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
38
|
+
as: 'userLoanList',
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -60,6 +60,11 @@ UserPayoutModel.init({
|
|
|
60
60
|
allowNull: false,
|
|
61
61
|
field: 'institute_id',
|
|
62
62
|
},
|
|
63
|
+
academicCalendarId: {
|
|
64
|
+
type: sequelize_1.DataTypes.UUID,
|
|
65
|
+
allowNull: true,
|
|
66
|
+
field: 'academic_calendar_id',
|
|
67
|
+
},
|
|
63
68
|
totalPayableAmount: {
|
|
64
69
|
type: sequelize_1.DataTypes.FLOAT,
|
|
65
70
|
allowNull: true,
|
package/package.json
CHANGED