@kipicore/dbcore 1.1.469 → 1.1.471
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/constants/app.d.ts +5 -0
- package/dist/constants/app.js +7 -1
- package/dist/db/psql/migrations/20260425000001-create_user_loans.d.ts +2 -0
- package/dist/db/psql/migrations/20260425000001-create_user_loans.js +82 -0
- package/dist/db/psql/migrations/20260425000002-create_loan_emis.d.ts +2 -0
- package/dist/db/psql/migrations/20260425000002-create_loan_emis.js +78 -0
- package/dist/db/psql/migrations/20260425000003-create_additional_payouts.d.ts +2 -0
- package/dist/db/psql/migrations/20260425000003-create_additional_payouts.js +90 -0
- package/dist/db/psql/migrations/20260425000004-create_payout_transaction_histories.d.ts +2 -0
- package/dist/db/psql/migrations/20260425000004-create_payout_transaction_histories.js +84 -0
- package/dist/interfaces/additionalPayoutInterface.d.ts +19 -0
- package/dist/interfaces/additionalPayoutInterface.js +2 -0
- package/dist/interfaces/loanEmiInterface.d.ts +16 -0
- package/dist/interfaces/loanEmiInterface.js +2 -0
- package/dist/interfaces/payoutTransactionHistoryInterface.d.ts +17 -0
- package/dist/interfaces/payoutTransactionHistoryInterface.js +2 -0
- package/dist/interfaces/userInstituteMetaInterface.d.ts +1 -0
- package/dist/interfaces/userLoanInterface.d.ts +17 -0
- package/dist/interfaces/userLoanInterface.js +2 -0
- package/dist/models/mongodb/userInstituteMetaModel.js +3 -0
- package/dist/models/psql/additionalPayoutModel.d.ts +24 -0
- package/dist/models/psql/additionalPayoutModel.js +100 -0
- package/dist/models/psql/loanEmiModel.d.ts +21 -0
- package/dist/models/psql/loanEmiModel.js +74 -0
- package/dist/models/psql/payoutTransactionHistoryModel.d.ts +22 -0
- package/dist/models/psql/payoutTransactionHistoryModel.js +86 -0
- package/dist/models/psql/userLoanModel.d.ts +22 -0
- package/dist/models/psql/userLoanModel.js +86 -0
- package/dist/types/additionalPayoutType.d.ts +3 -0
- package/dist/types/additionalPayoutType.js +2 -0
- package/dist/types/loanEmiType.d.ts +3 -0
- package/dist/types/loanEmiType.js +2 -0
- package/dist/types/payoutTransactionHistoryType.d.ts +3 -0
- package/dist/types/payoutTransactionHistoryType.js +2 -0
- package/dist/types/userLoanType.d.ts +3 -0
- package/dist/types/userLoanType.js +2 -0
- package/package.json +1 -1
package/dist/constants/app.d.ts
CHANGED
package/dist/constants/app.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.SCHOOL_SHIFT = exports.WORKIN_DAY_STATUS = exports.LEAVE_STATUS = export
|
|
|
4
4
|
exports.USER_CHAPTER_INDEX_STATUS = exports.CHAPTER_INDEX_TYPE = exports.IMAGE__NAME = exports.INQUIRY_STATUS = exports.INQUIRY_REFERRED_BY = exports.EXAM_GROUP_STANDARD_RESULT = exports.EXAM_GROUP_STATUS = exports.SUBJECT_INDEX_TYPE = exports.LECTURE_SLOT_DURATION = exports.EXAM_ANSWER_SHEET_QUESTION_RESULT = exports.PAYMENT_TERMS_TYPE = exports.PAYMENT_TERMS_STATUS = exports.EXAM_ANSWER_SHEET_RESULT_TYPE = exports.EXAM_ANSWER_SHEET_RESULT_STATUS = exports.EXAM_ANSWER_SHEET_STATUS = exports.EXAM_VALID_ANSWER_TYPE = exports.EXAM_ANSWER_SELECTION_TYPE = exports.EXAM_STATUS = exports.COURSE_STATUS = exports.EXAM_MODE = exports.GREETING_STATUS = exports.USER_HAS_ANNOUCEMENT_STATUS = exports.ANNOUCEMENT_STATUS = exports.TYPE_OF_USER = exports.ANNOUCEMENT_SCHEDULE_TYPE = exports.APPROVE_REQUEST_STATUS = exports.APPROVE_REQUEST_TYPE = exports.TYPE_MANAGEMENT_STATUS = exports.TYPE_MANAGEMENT_TYPE = exports.FILE_TYPE = exports.ACADEMIC_CALENDARS_STATUS = exports.BANNER_TYPE = exports.APP_TYPE = exports.FEED_BACK_STATUS = exports.FEED_BACK_TYPE = exports.FACILITY_TYPE = exports.EMPLOYMENT_TYPE = exports.USER_INSTITUTE_META_STATUS = exports.USER_HAS_PARENT_STATUS = exports.GUARDIANS_USER_META_MODEL_STATUS = exports.DISABILITY_TYPE = exports.WORK_CATEGORY = exports.BLOG_STATUS = exports.WORK_TYPE = exports.USER_DETAILS = exports.NO_TYPE = exports.ADMISSION_TYPE = exports.INSTITUTE_ENTITY_TYPE_SEQUENCE = exports.INSTITUTE_ENTITY_TYPE_STATUS = exports.INSTITUTE_ENTITY_STATUS = void 0;
|
|
5
5
|
exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_PLAN_CHARGE_INTERVAL = exports.DISCOUNT_TYPE = exports.CONTACT_FEED_BACK_TYPE = exports.PLANNER_SYNC_STATUS = exports.NOTIFICATION_ACTION = exports.NOTIFICATION_MODULE_TYPE = exports.NOTIFICATION_STATUS = exports.NOTIFICATION_TYPE = exports.PROJECT_ASSESSMENT_OPTION_STATUS = exports.USER_BOOK_ASSESSMENT_STATUS = exports.BOOK_ASSESSMENT_DATE_STATUS = exports.TASK_MANAGEMENT_STATUS = exports.USER_DETAILS_FILED = exports.DEVICE_TYPE = exports.templateKeyWord = exports.bankAccountRegexMap = exports.EMAIL_SUBJECTS = exports.PDF_TEMPLATES = exports.EMAIL_TEMPLATES = exports.PINCODE_API_URL = exports.APPLE_AUTH = exports.META_AUTH = exports.GOOGLE_AUTH = exports.API_URL = exports.DEFAULT_USER_LOGO = exports.DEFAULT_INSTITUTED_LOGO = exports.UPLOAD_PATH = exports.SVG_URL_PATH = exports.TO_DO_STATUS = exports.LECTURE_TITLE = exports.LECTURE_STATUS = exports.SCHOOL_INFORMATION_STEP = exports.CASTE = exports.RELIGION_CASTE = exports.NATIONALITY = exports.CATEGORY = exports.IS_PRINCIPAL = exports.FEE_TYPE = exports.BOOLEAN_STATUS = exports.PROPERTY_STATUS = exports.DESIGNATION_OF_PERSON = exports.TRUST_REGISTERED_UNDER = exports.TRUST_TYPE = exports.SVA_NAME = exports.QDC_NAME = exports.USER_PAYOUT_TYPE = exports.PARENTS_CHILDREN_CURRENT = exports.CHAPTER_INDEX_FILE_TYPE = exports.FEE_HISTORY_STATUS = void 0;
|
|
6
6
|
exports.STUDENT_LEAVE_STATUS = exports.CERTIFICATE_TYPE = exports.CERTIFICATE_FOR = exports.SHEET_TYPE = exports.COMPETITION_USER_ROLE = exports.RESULT_STATUS = exports.COMPETITION_STATUS = exports.STATUS_BY_PARENTS = exports.COMPETITION_TYPE = exports.CAMPUS_CARNIVAL_STATUS = exports.COMPETITION_TYPE_CATEGORY = exports.COMPETITION_EVENTS = exports.PAYMENT_STATUS = exports.INCOME_EXPENSE_SOURCE = exports.INCOME_EXPENSE_TYPE = exports.APPOINTMENT_STATUS = exports.MAINTENANCE_MODULE_NAME = exports.MAINTENANCE_TYPE = exports.MAINTENANCE_MODE = exports.ASSIGN_FILE_TYPE = exports.LOST_FOUND_ITEM_STATUS = exports.PAYMENT_PROCESSING_CALLBACK_URL = exports.PAYMENT_PROCESSING_PAGE_URL = exports.PAYMENT_PROCESSING_STATUS_URL = exports.WALLET_TRANSACTION_VALID_DATE_FOR_OTP_IN_MINUTES = exports.WALLET_TRANSACTION_VALID_DATE_IN_MINUTES = exports.PAYMENT_METHODS = exports.PAYMENT_GATEWAY_TYPES = exports.JOB_ACTION = exports.ONE_GB_BYTES = exports.CHARGE_PER_TRANSACTION_ITEM_UNIT = exports.INSTITUTE_SUBSCRIPTION_PLAN_STATUS = exports.WALLET_TRANSACTION_USERS_TYPE = exports.WALLET_HISTORY_STATUS = exports.WALLET_HISTORY_ACTION = exports.WALLET_HISTORY_ITEM_TYPE = exports.WALLET_HISTORY_TYPE = exports.REPLACE_TEACHER_STATUS = exports.TEACHER_TYPE = exports.INVOICE_TYPE = exports.PURCHASE_STATUS = exports.COLUMN_LIST_TITLE = exports.INVOICE_PAYMENT_TYPE = exports.PDF_CHEQUE_FREQUENCY = exports.PDF_CHEQUE_STATUS = exports.LANGUAGES = exports.HOME_WORK_STATUS = exports.SOCKET_EVENTS = exports.SUBSCRIPTION_PLAN_FILES_TYPE = exports.VALID_CURRENCY = void 0;
|
|
7
|
-
exports.NOTICEBOARD_STATUS = exports.NOTICEBOARD_TYPE = exports.PERMISSION_TYPE = exports.NOTIFICATION_SEND_STATUS = exports.MEMBERSHIP_STATUS = exports.COMMUNITY_TYPE = exports.DESIGNATION_TYPE = exports.ADDITIONAL_PAYOUT_TYPE = exports.POSTAL_DISPATCH_STATUS = exports.CALL_TYPE = exports.SEARCH_TYPE = exports.REPORT_TYPE = exports.DEVICE_TYPE_APP_ANALYTICS = exports.APP_ANALYTICS_EVENT_TYPE = exports.EXPORT_SHEET_TYPE = exports.GRANT_AND_DONATION_TYPE = exports.TICKET_RAISE_PRIORITY = exports.TICKET_RAISE_STATUS = exports.TERM_AND_CONDITION_STATUS = exports.EDUCATION_OFFICER_TYPE = exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = exports.FEE_COLLECTION_TYPE = exports.BANK_ACCOUNT_TYPE = exports.STUDENT_LEAVE_TYPE = void 0;
|
|
7
|
+
exports.PAYOUT_STATUS = exports.NOTICEBOARD_STATUS = exports.NOTICEBOARD_TYPE = exports.PERMISSION_TYPE = exports.NOTIFICATION_SEND_STATUS = exports.MEMBERSHIP_STATUS = exports.COMMUNITY_TYPE = exports.DESIGNATION_TYPE = exports.ADDITIONAL_PAYOUT_TYPE = exports.POSTAL_DISPATCH_STATUS = exports.CALL_TYPE = exports.SEARCH_TYPE = exports.REPORT_TYPE = exports.DEVICE_TYPE_APP_ANALYTICS = exports.APP_ANALYTICS_EVENT_TYPE = exports.EXPORT_SHEET_TYPE = exports.GRANT_AND_DONATION_TYPE = exports.TICKET_RAISE_PRIORITY = exports.TICKET_RAISE_STATUS = exports.TERM_AND_CONDITION_STATUS = exports.EDUCATION_OFFICER_TYPE = exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = exports.FEE_COLLECTION_TYPE = exports.BANK_ACCOUNT_TYPE = exports.STUDENT_LEAVE_TYPE = void 0;
|
|
8
8
|
const env_1 = require("../configs/env");
|
|
9
9
|
exports.SIXTY = 60;
|
|
10
10
|
exports.ONE_HUNDRED = 100;
|
|
@@ -1627,3 +1627,9 @@ var NOTICEBOARD_STATUS;
|
|
|
1627
1627
|
NOTICEBOARD_STATUS["ACTIVE"] = "ACTIVE";
|
|
1628
1628
|
NOTICEBOARD_STATUS["INACTIVE"] = "INACTIVE";
|
|
1629
1629
|
})(NOTICEBOARD_STATUS || (exports.NOTICEBOARD_STATUS = NOTICEBOARD_STATUS = {}));
|
|
1630
|
+
var PAYOUT_STATUS;
|
|
1631
|
+
(function (PAYOUT_STATUS) {
|
|
1632
|
+
PAYOUT_STATUS["PAID"] = "PAID";
|
|
1633
|
+
PAYOUT_STATUS["DUE"] = "DUE";
|
|
1634
|
+
PAYOUT_STATUS["PARTIAL_PAID"] = "PARTIAL_PAID";
|
|
1635
|
+
})(PAYOUT_STATUS || (exports.PAYOUT_STATUS = PAYOUT_STATUS = {}));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const tableName = 'user_loans';
|
|
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
|
+
user_id: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
},
|
|
20
|
+
institute_id: {
|
|
21
|
+
type: Sequelize.UUID,
|
|
22
|
+
allowNull: true,
|
|
23
|
+
},
|
|
24
|
+
academic_calendar_id: {
|
|
25
|
+
type: Sequelize.UUID,
|
|
26
|
+
allowNull: true,
|
|
27
|
+
},
|
|
28
|
+
additional_payout_type_id: {
|
|
29
|
+
type: Sequelize.UUID,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
},
|
|
32
|
+
amount: {
|
|
33
|
+
type: Sequelize.FLOAT,
|
|
34
|
+
allowNull: true,
|
|
35
|
+
defaultValue: 0,
|
|
36
|
+
},
|
|
37
|
+
description: {
|
|
38
|
+
type: Sequelize.STRING,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
},
|
|
41
|
+
status: {
|
|
42
|
+
type: Sequelize.STRING,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
defaultValue: 'DUE',
|
|
45
|
+
},
|
|
46
|
+
created_by: {
|
|
47
|
+
type: Sequelize.UUID,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
},
|
|
50
|
+
updated_by: {
|
|
51
|
+
type: Sequelize.UUID,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
},
|
|
54
|
+
deleted_by: {
|
|
55
|
+
type: Sequelize.UUID,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
},
|
|
58
|
+
created_at: {
|
|
59
|
+
type: Sequelize.DATE,
|
|
60
|
+
allowNull: true,
|
|
61
|
+
defaultValue: Sequelize.NOW,
|
|
62
|
+
},
|
|
63
|
+
updated_at: {
|
|
64
|
+
type: Sequelize.DATE,
|
|
65
|
+
allowNull: true,
|
|
66
|
+
defaultValue: Sequelize.NOW,
|
|
67
|
+
},
|
|
68
|
+
deleted_at: {
|
|
69
|
+
type: Sequelize.DATE,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const down = async (queryInterface) => {
|
|
76
|
+
const tableName = 'user_loans';
|
|
77
|
+
await queryInterface.dropTable(tableName);
|
|
78
|
+
};
|
|
79
|
+
module.exports = {
|
|
80
|
+
up,
|
|
81
|
+
down,
|
|
82
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const tableName = 'loan_emis';
|
|
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
|
+
user_loan_id: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
},
|
|
20
|
+
academic_calendar_id: {
|
|
21
|
+
type: Sequelize.UUID,
|
|
22
|
+
allowNull: true,
|
|
23
|
+
},
|
|
24
|
+
amount: {
|
|
25
|
+
type: Sequelize.FLOAT,
|
|
26
|
+
allowNull: true,
|
|
27
|
+
defaultValue: 0,
|
|
28
|
+
},
|
|
29
|
+
due_date: {
|
|
30
|
+
type: Sequelize.DATE,
|
|
31
|
+
allowNull: true,
|
|
32
|
+
},
|
|
33
|
+
paid_date: {
|
|
34
|
+
type: Sequelize.DATE,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
},
|
|
37
|
+
status: {
|
|
38
|
+
type: Sequelize.STRING,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
defaultValue: 'DUE',
|
|
41
|
+
},
|
|
42
|
+
created_by: {
|
|
43
|
+
type: Sequelize.UUID,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
},
|
|
46
|
+
updated_by: {
|
|
47
|
+
type: Sequelize.UUID,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
},
|
|
50
|
+
deleted_by: {
|
|
51
|
+
type: Sequelize.UUID,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
},
|
|
54
|
+
created_at: {
|
|
55
|
+
type: Sequelize.DATE,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
defaultValue: Sequelize.NOW,
|
|
58
|
+
},
|
|
59
|
+
updated_at: {
|
|
60
|
+
type: Sequelize.DATE,
|
|
61
|
+
allowNull: true,
|
|
62
|
+
defaultValue: Sequelize.NOW,
|
|
63
|
+
},
|
|
64
|
+
deleted_at: {
|
|
65
|
+
type: Sequelize.DATE,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const down = async (queryInterface) => {
|
|
72
|
+
const tableName = 'loan_emis';
|
|
73
|
+
await queryInterface.dropTable(tableName);
|
|
74
|
+
};
|
|
75
|
+
module.exports = {
|
|
76
|
+
up,
|
|
77
|
+
down,
|
|
78
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const tableName = 'additional_payouts';
|
|
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
|
+
user_id: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
},
|
|
20
|
+
institute_id: {
|
|
21
|
+
type: Sequelize.UUID,
|
|
22
|
+
allowNull: true,
|
|
23
|
+
},
|
|
24
|
+
academic_calendar_id: {
|
|
25
|
+
type: Sequelize.UUID,
|
|
26
|
+
allowNull: true,
|
|
27
|
+
},
|
|
28
|
+
additional_payout_type_id: {
|
|
29
|
+
type: Sequelize.UUID,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
},
|
|
32
|
+
loan_emi_id: {
|
|
33
|
+
type: Sequelize.UUID,
|
|
34
|
+
allowNull: true,
|
|
35
|
+
},
|
|
36
|
+
amount: {
|
|
37
|
+
type: Sequelize.FLOAT,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
defaultValue: 0,
|
|
40
|
+
},
|
|
41
|
+
effective_date: {
|
|
42
|
+
type: Sequelize.DATE,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
},
|
|
45
|
+
description: {
|
|
46
|
+
type: Sequelize.STRING,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
},
|
|
49
|
+
status: {
|
|
50
|
+
type: Sequelize.STRING,
|
|
51
|
+
allowNull: true,
|
|
52
|
+
defaultValue: 'DUE',
|
|
53
|
+
},
|
|
54
|
+
created_by: {
|
|
55
|
+
type: Sequelize.UUID,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
},
|
|
58
|
+
updated_by: {
|
|
59
|
+
type: Sequelize.UUID,
|
|
60
|
+
allowNull: true,
|
|
61
|
+
},
|
|
62
|
+
deleted_by: {
|
|
63
|
+
type: Sequelize.UUID,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
},
|
|
66
|
+
created_at: {
|
|
67
|
+
type: Sequelize.DATE,
|
|
68
|
+
allowNull: true,
|
|
69
|
+
defaultValue: Sequelize.NOW,
|
|
70
|
+
},
|
|
71
|
+
updated_at: {
|
|
72
|
+
type: Sequelize.DATE,
|
|
73
|
+
allowNull: true,
|
|
74
|
+
defaultValue: Sequelize.NOW,
|
|
75
|
+
},
|
|
76
|
+
deleted_at: {
|
|
77
|
+
type: Sequelize.DATE,
|
|
78
|
+
allowNull: true,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const down = async (queryInterface) => {
|
|
84
|
+
const tableName = 'additional_payouts';
|
|
85
|
+
await queryInterface.dropTable(tableName);
|
|
86
|
+
};
|
|
87
|
+
module.exports = {
|
|
88
|
+
up,
|
|
89
|
+
down,
|
|
90
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const tableName = 'payout_transaction_histories';
|
|
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
|
+
user_id: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
},
|
|
20
|
+
institute_id: {
|
|
21
|
+
type: Sequelize.UUID,
|
|
22
|
+
allowNull: true,
|
|
23
|
+
},
|
|
24
|
+
academic_calendar_id: {
|
|
25
|
+
type: Sequelize.UUID,
|
|
26
|
+
allowNull: true,
|
|
27
|
+
},
|
|
28
|
+
total_amount: {
|
|
29
|
+
type: Sequelize.FLOAT,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
defaultValue: 0,
|
|
32
|
+
},
|
|
33
|
+
payable_amount: {
|
|
34
|
+
type: Sequelize.FLOAT,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
defaultValue: 0,
|
|
37
|
+
},
|
|
38
|
+
additional_payout_ids: {
|
|
39
|
+
type: Sequelize.JSONB,
|
|
40
|
+
allowNull: true,
|
|
41
|
+
defaultValue: [],
|
|
42
|
+
},
|
|
43
|
+
status: {
|
|
44
|
+
type: Sequelize.STRING,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
defaultValue: 'DUE',
|
|
47
|
+
},
|
|
48
|
+
created_by: {
|
|
49
|
+
type: Sequelize.UUID,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
},
|
|
52
|
+
updated_by: {
|
|
53
|
+
type: Sequelize.UUID,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
},
|
|
56
|
+
deleted_by: {
|
|
57
|
+
type: Sequelize.UUID,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
},
|
|
60
|
+
created_at: {
|
|
61
|
+
type: Sequelize.DATE,
|
|
62
|
+
allowNull: true,
|
|
63
|
+
defaultValue: Sequelize.NOW,
|
|
64
|
+
},
|
|
65
|
+
updated_at: {
|
|
66
|
+
type: Sequelize.DATE,
|
|
67
|
+
allowNull: true,
|
|
68
|
+
defaultValue: Sequelize.NOW,
|
|
69
|
+
},
|
|
70
|
+
deleted_at: {
|
|
71
|
+
type: Sequelize.DATE,
|
|
72
|
+
allowNull: true,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const down = async (queryInterface) => {
|
|
78
|
+
const tableName = 'payout_transaction_histories';
|
|
79
|
+
await queryInterface.dropTable(tableName);
|
|
80
|
+
};
|
|
81
|
+
module.exports = {
|
|
82
|
+
up,
|
|
83
|
+
down,
|
|
84
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PAYOUT_STATUS } from '../constants/app';
|
|
2
|
+
export interface IAdditionalPayoutModelAttributes {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
instituteId: string;
|
|
6
|
+
academicCalendarId: string;
|
|
7
|
+
loanEmiId?: string;
|
|
8
|
+
additionalPayoutTypeId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
effectiveDate: Date;
|
|
11
|
+
description?: string;
|
|
12
|
+
status?: PAYOUT_STATUS;
|
|
13
|
+
createdBy?: string;
|
|
14
|
+
updatedBy?: string;
|
|
15
|
+
deletedBy?: string;
|
|
16
|
+
createdAt?: Date;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
deletedAt?: Date;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PAYOUT_STATUS } from '../constants/app';
|
|
2
|
+
export interface ILoanEmiModelAttributes {
|
|
3
|
+
id: string;
|
|
4
|
+
userLoanId: string;
|
|
5
|
+
academicCalendarId: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
dueDate: Date;
|
|
8
|
+
paidDate?: Date;
|
|
9
|
+
status: PAYOUT_STATUS;
|
|
10
|
+
createdBy?: string;
|
|
11
|
+
updatedBy?: string;
|
|
12
|
+
deletedBy?: string;
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
deletedAt?: Date;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PAYOUT_STATUS } from '../constants/app';
|
|
2
|
+
export interface IPayoutTransactionHistoryModelAttributes {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
instituteId: string;
|
|
6
|
+
academicCalendarId: string;
|
|
7
|
+
totalAmount: number;
|
|
8
|
+
payableAmount: number;
|
|
9
|
+
additionalPayoutIds: string[];
|
|
10
|
+
status?: PAYOUT_STATUS;
|
|
11
|
+
createdBy?: string;
|
|
12
|
+
updatedBy?: string;
|
|
13
|
+
deletedBy?: string;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
deletedAt?: Date;
|
|
17
|
+
}
|
|
@@ -61,6 +61,7 @@ export interface IUserInstituteMetaAttributes extends IDefaultAttributes, Docume
|
|
|
61
61
|
isFeeCarryForward: boolean;
|
|
62
62
|
isFeeCollectionCreated: boolean;
|
|
63
63
|
designationId?: string;
|
|
64
|
+
studentProfileImage?: string;
|
|
64
65
|
}
|
|
65
66
|
export interface IUserWiseData {
|
|
66
67
|
userId: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PAYOUT_STATUS } from "../constants";
|
|
2
|
+
export interface IUserLoanModelAttributes {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
instituteId: string;
|
|
6
|
+
academicCalendarId: string;
|
|
7
|
+
additionalPayoutTypeId: string;
|
|
8
|
+
amount?: number;
|
|
9
|
+
description?: string;
|
|
10
|
+
status?: PAYOUT_STATUS;
|
|
11
|
+
createdBy?: string;
|
|
12
|
+
updatedBy?: string;
|
|
13
|
+
deletedBy?: string;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
deletedAt?: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IAdditionalPayoutModelAttributes } from '../../interfaces/additionalPayoutInterface';
|
|
3
|
+
import { TAdditionalPayoutModelCreationAttributes } from '../../types/additionalPayoutType';
|
|
4
|
+
import { PAYOUT_STATUS } from '../../constants/app';
|
|
5
|
+
declare class AdditionalPayoutModel extends Model<IAdditionalPayoutModelAttributes, TAdditionalPayoutModelCreationAttributes> {
|
|
6
|
+
id: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
instituteId: string;
|
|
9
|
+
academicCalendarId: string;
|
|
10
|
+
loanEmiId: string;
|
|
11
|
+
additionalPayoutTypeId: string;
|
|
12
|
+
amount: number;
|
|
13
|
+
effectiveDate: Date;
|
|
14
|
+
description: string;
|
|
15
|
+
status: PAYOUT_STATUS;
|
|
16
|
+
createdBy: string;
|
|
17
|
+
updatedBy: string;
|
|
18
|
+
deletedBy: string;
|
|
19
|
+
readonly createdAt: Date;
|
|
20
|
+
readonly deletedAt: Date;
|
|
21
|
+
readonly updatedAt: Date;
|
|
22
|
+
static associate(models: any): void;
|
|
23
|
+
}
|
|
24
|
+
export default AdditionalPayoutModel;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class AdditionalPayoutModel extends sequelize_1.Model {
|
|
6
|
+
static associate(models) {
|
|
7
|
+
const { UserModel, InstituteModel, AdditionalPayoutTypeModel, AcademicCalendarModel, LoanEmiModel } = models;
|
|
8
|
+
AdditionalPayoutModel.belongsTo(UserModel, {
|
|
9
|
+
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
|
+
as: 'createdByUser',
|
|
11
|
+
});
|
|
12
|
+
AdditionalPayoutModel.belongsTo(UserModel, {
|
|
13
|
+
foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
|
|
14
|
+
as: 'updatedByUser',
|
|
15
|
+
});
|
|
16
|
+
AdditionalPayoutModel.belongsTo(UserModel, {
|
|
17
|
+
foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
|
|
18
|
+
as: 'deletedByUser',
|
|
19
|
+
});
|
|
20
|
+
AdditionalPayoutModel.belongsTo(UserModel, {
|
|
21
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
22
|
+
as: 'user',
|
|
23
|
+
});
|
|
24
|
+
AdditionalPayoutModel.belongsTo(InstituteModel, {
|
|
25
|
+
foreignKey: { name: 'instituteId', field: 'institute_id' },
|
|
26
|
+
as: 'institute',
|
|
27
|
+
});
|
|
28
|
+
AdditionalPayoutModel.belongsTo(AdditionalPayoutTypeModel, {
|
|
29
|
+
foreignKey: { name: 'additionalPayoutTypeId', field: 'additional_payout_type_id' },
|
|
30
|
+
as: 'additionalPayoutType',
|
|
31
|
+
});
|
|
32
|
+
AdditionalPayoutModel.belongsTo(AcademicCalendarModel, {
|
|
33
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
34
|
+
as: 'academicCalendar',
|
|
35
|
+
});
|
|
36
|
+
AdditionalPayoutModel.belongsTo(LoanEmiModel, {
|
|
37
|
+
foreignKey: { name: 'loanEmiId', field: 'loan_emi_id' },
|
|
38
|
+
as: 'loanEmi',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
AdditionalPayoutModel.init({
|
|
43
|
+
id: {
|
|
44
|
+
type: sequelize_1.DataTypes.UUID,
|
|
45
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
46
|
+
allowNull: false,
|
|
47
|
+
primaryKey: true,
|
|
48
|
+
},
|
|
49
|
+
userId: {
|
|
50
|
+
type: sequelize_1.DataTypes.UUID,
|
|
51
|
+
allowNull: true,
|
|
52
|
+
field: 'user_id',
|
|
53
|
+
},
|
|
54
|
+
instituteId: {
|
|
55
|
+
type: sequelize_1.DataTypes.UUID,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
field: 'institute_id',
|
|
58
|
+
},
|
|
59
|
+
academicCalendarId: {
|
|
60
|
+
type: sequelize_1.DataTypes.UUID,
|
|
61
|
+
allowNull: true,
|
|
62
|
+
field: 'academic_calendar_id',
|
|
63
|
+
},
|
|
64
|
+
additionalPayoutTypeId: {
|
|
65
|
+
type: sequelize_1.DataTypes.UUID,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
field: 'additional_payout_type_id',
|
|
68
|
+
},
|
|
69
|
+
loanEmiId: {
|
|
70
|
+
type: sequelize_1.DataTypes.UUID,
|
|
71
|
+
allowNull: true,
|
|
72
|
+
field: 'loan_emi_id',
|
|
73
|
+
},
|
|
74
|
+
amount: {
|
|
75
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
defaultValue: 0,
|
|
78
|
+
},
|
|
79
|
+
effectiveDate: {
|
|
80
|
+
type: sequelize_1.DataTypes.DATE,
|
|
81
|
+
allowNull: true,
|
|
82
|
+
field: 'effective_date',
|
|
83
|
+
},
|
|
84
|
+
description: {
|
|
85
|
+
type: sequelize_1.DataTypes.STRING,
|
|
86
|
+
allowNull: true,
|
|
87
|
+
},
|
|
88
|
+
status: {
|
|
89
|
+
type: sequelize_1.DataTypes.STRING,
|
|
90
|
+
allowNull: true,
|
|
91
|
+
defaultValue: 'DUE',
|
|
92
|
+
},
|
|
93
|
+
}, {
|
|
94
|
+
modelName: 'AdditionalPayoutModel',
|
|
95
|
+
tableName: 'additional_payouts',
|
|
96
|
+
timestamps: true,
|
|
97
|
+
paranoid: true,
|
|
98
|
+
sequelize: index_1.sequelize,
|
|
99
|
+
});
|
|
100
|
+
exports.default = AdditionalPayoutModel;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { ILoanEmiModelAttributes } from '../../interfaces/loanEmiInterface';
|
|
3
|
+
import { TLoanEmiModelCreationAttributes } from '../../types/loanEmiType';
|
|
4
|
+
import { PAYOUT_STATUS } from '../../constants/app';
|
|
5
|
+
declare class LoanEmiModel extends Model<ILoanEmiModelAttributes, TLoanEmiModelCreationAttributes> {
|
|
6
|
+
id: string;
|
|
7
|
+
userLoanId: string;
|
|
8
|
+
academicCalendarId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
dueDate: Date;
|
|
11
|
+
paidDate: Date;
|
|
12
|
+
status: PAYOUT_STATUS;
|
|
13
|
+
createdBy: string;
|
|
14
|
+
updatedBy: string;
|
|
15
|
+
deletedBy: string;
|
|
16
|
+
readonly createdAt: Date;
|
|
17
|
+
readonly deletedAt: Date;
|
|
18
|
+
readonly updatedAt: Date;
|
|
19
|
+
static associate(models: any): void;
|
|
20
|
+
}
|
|
21
|
+
export default LoanEmiModel;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class LoanEmiModel extends sequelize_1.Model {
|
|
6
|
+
static associate(models) {
|
|
7
|
+
const { UserModel, UserLoanModel, AcademicCalendarModel } = models;
|
|
8
|
+
LoanEmiModel.belongsTo(UserModel, {
|
|
9
|
+
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
|
+
as: 'createdByUser',
|
|
11
|
+
});
|
|
12
|
+
LoanEmiModel.belongsTo(UserModel, {
|
|
13
|
+
foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
|
|
14
|
+
as: 'updatedByUser',
|
|
15
|
+
});
|
|
16
|
+
LoanEmiModel.belongsTo(UserModel, {
|
|
17
|
+
foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
|
|
18
|
+
as: 'deletedByUser',
|
|
19
|
+
});
|
|
20
|
+
LoanEmiModel.belongsTo(UserLoanModel, {
|
|
21
|
+
foreignKey: { name: 'userLoanId', field: 'user_loan_id' },
|
|
22
|
+
as: 'userLoan',
|
|
23
|
+
});
|
|
24
|
+
LoanEmiModel.belongsTo(AcademicCalendarModel, {
|
|
25
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
26
|
+
as: 'academicCalendar',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
LoanEmiModel.init({
|
|
31
|
+
id: {
|
|
32
|
+
type: sequelize_1.DataTypes.UUID,
|
|
33
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
34
|
+
allowNull: false,
|
|
35
|
+
primaryKey: true,
|
|
36
|
+
},
|
|
37
|
+
userLoanId: {
|
|
38
|
+
type: sequelize_1.DataTypes.UUID,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
field: 'user_loan_id',
|
|
41
|
+
},
|
|
42
|
+
academicCalendarId: {
|
|
43
|
+
type: sequelize_1.DataTypes.UUID,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
field: 'academic_calendar_id',
|
|
46
|
+
},
|
|
47
|
+
amount: {
|
|
48
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
defaultValue: 0,
|
|
51
|
+
},
|
|
52
|
+
dueDate: {
|
|
53
|
+
type: sequelize_1.DataTypes.DATE,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
field: 'due_date',
|
|
56
|
+
},
|
|
57
|
+
paidDate: {
|
|
58
|
+
type: sequelize_1.DataTypes.DATE,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
field: 'paid_date',
|
|
61
|
+
},
|
|
62
|
+
status: {
|
|
63
|
+
type: sequelize_1.DataTypes.STRING,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
defaultValue: 'DUE',
|
|
66
|
+
},
|
|
67
|
+
}, {
|
|
68
|
+
modelName: 'LoanEmiModel',
|
|
69
|
+
tableName: 'loan_emis',
|
|
70
|
+
timestamps: true,
|
|
71
|
+
paranoid: true,
|
|
72
|
+
sequelize: index_1.sequelize,
|
|
73
|
+
});
|
|
74
|
+
exports.default = LoanEmiModel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IPayoutTransactionHistoryModelAttributes } from '../../interfaces/payoutTransactionHistoryInterface';
|
|
3
|
+
import { TPayoutTransactionHistoryModelCreationAttributes } from '../../types/payoutTransactionHistoryType';
|
|
4
|
+
import { PAYOUT_STATUS } from '../../constants/app';
|
|
5
|
+
declare class PayoutTransactionHistoryModel extends Model<IPayoutTransactionHistoryModelAttributes, TPayoutTransactionHistoryModelCreationAttributes> {
|
|
6
|
+
id: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
instituteId: string;
|
|
9
|
+
academicCalendarId: string;
|
|
10
|
+
totalAmount: number;
|
|
11
|
+
payableAmount: number;
|
|
12
|
+
additionalPayoutIds: string[];
|
|
13
|
+
status: PAYOUT_STATUS;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
updatedBy: string;
|
|
16
|
+
deletedBy: string;
|
|
17
|
+
readonly createdAt: Date;
|
|
18
|
+
readonly deletedAt: Date;
|
|
19
|
+
readonly updatedAt: Date;
|
|
20
|
+
static associate(models: any): void;
|
|
21
|
+
}
|
|
22
|
+
export default PayoutTransactionHistoryModel;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class PayoutTransactionHistoryModel extends sequelize_1.Model {
|
|
6
|
+
static associate(models) {
|
|
7
|
+
const { UserModel, InstituteModel, AcademicCalendarModel } = models;
|
|
8
|
+
PayoutTransactionHistoryModel.belongsTo(UserModel, {
|
|
9
|
+
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
|
+
as: 'createdByUser',
|
|
11
|
+
});
|
|
12
|
+
PayoutTransactionHistoryModel.belongsTo(UserModel, {
|
|
13
|
+
foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
|
|
14
|
+
as: 'updatedByUser',
|
|
15
|
+
});
|
|
16
|
+
PayoutTransactionHistoryModel.belongsTo(UserModel, {
|
|
17
|
+
foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
|
|
18
|
+
as: 'deletedByUser',
|
|
19
|
+
});
|
|
20
|
+
PayoutTransactionHistoryModel.belongsTo(UserModel, {
|
|
21
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
22
|
+
as: 'user',
|
|
23
|
+
});
|
|
24
|
+
PayoutTransactionHistoryModel.belongsTo(InstituteModel, {
|
|
25
|
+
foreignKey: { name: 'instituteId', field: 'institute_id' },
|
|
26
|
+
as: 'institute',
|
|
27
|
+
});
|
|
28
|
+
PayoutTransactionHistoryModel.belongsTo(AcademicCalendarModel, {
|
|
29
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
30
|
+
as: 'academicCalendar',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
PayoutTransactionHistoryModel.init({
|
|
35
|
+
id: {
|
|
36
|
+
type: sequelize_1.DataTypes.UUID,
|
|
37
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
38
|
+
allowNull: false,
|
|
39
|
+
primaryKey: true,
|
|
40
|
+
},
|
|
41
|
+
userId: {
|
|
42
|
+
type: sequelize_1.DataTypes.UUID,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
field: 'user_id',
|
|
45
|
+
},
|
|
46
|
+
instituteId: {
|
|
47
|
+
type: sequelize_1.DataTypes.UUID,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
field: 'institute_id',
|
|
50
|
+
},
|
|
51
|
+
academicCalendarId: {
|
|
52
|
+
type: sequelize_1.DataTypes.UUID,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
field: 'academic_calendar_id',
|
|
55
|
+
},
|
|
56
|
+
totalAmount: {
|
|
57
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
defaultValue: 0,
|
|
60
|
+
field: 'total_amount',
|
|
61
|
+
},
|
|
62
|
+
payableAmount: {
|
|
63
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
defaultValue: 0,
|
|
66
|
+
field: 'payable_amount',
|
|
67
|
+
},
|
|
68
|
+
additionalPayoutIds: {
|
|
69
|
+
type: sequelize_1.DataTypes.JSONB,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
defaultValue: [],
|
|
72
|
+
field: 'additional_payout_ids',
|
|
73
|
+
},
|
|
74
|
+
status: {
|
|
75
|
+
type: sequelize_1.DataTypes.STRING,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
defaultValue: 'DUE',
|
|
78
|
+
},
|
|
79
|
+
}, {
|
|
80
|
+
modelName: 'PayoutTransactionHistoryModel',
|
|
81
|
+
tableName: 'payout_transaction_histories',
|
|
82
|
+
timestamps: true,
|
|
83
|
+
paranoid: true,
|
|
84
|
+
sequelize: index_1.sequelize,
|
|
85
|
+
});
|
|
86
|
+
exports.default = PayoutTransactionHistoryModel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { IUserLoanModelAttributes } from '../../interfaces/userLoanInterface';
|
|
3
|
+
import { TUserLoanModelCreationAttributes } from '../../types/userLoanType';
|
|
4
|
+
import { PAYOUT_STATUS } from '../../constants';
|
|
5
|
+
declare class UserLoanModel extends Model<IUserLoanModelAttributes, TUserLoanModelCreationAttributes> {
|
|
6
|
+
id: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
instituteId: string;
|
|
9
|
+
academicCalendarId: string;
|
|
10
|
+
additionalPayoutTypeId: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
description: string;
|
|
13
|
+
status: PAYOUT_STATUS;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
updatedBy: string;
|
|
16
|
+
deletedBy: string;
|
|
17
|
+
readonly createdAt: Date;
|
|
18
|
+
readonly deletedAt: Date;
|
|
19
|
+
readonly updatedAt: Date;
|
|
20
|
+
static associate(models: any): void;
|
|
21
|
+
}
|
|
22
|
+
export default UserLoanModel;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class UserLoanModel extends sequelize_1.Model {
|
|
6
|
+
static associate(models) {
|
|
7
|
+
const { UserModel, InstituteModel, AcademicCalendarModel, AdditionalPayoutTypeModel } = models;
|
|
8
|
+
UserLoanModel.belongsTo(UserModel, {
|
|
9
|
+
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
|
+
as: 'createdByUser',
|
|
11
|
+
});
|
|
12
|
+
UserLoanModel.belongsTo(UserModel, {
|
|
13
|
+
foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
|
|
14
|
+
as: 'updatedByUser',
|
|
15
|
+
});
|
|
16
|
+
UserLoanModel.belongsTo(UserModel, {
|
|
17
|
+
foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
|
|
18
|
+
as: 'deletedByUser',
|
|
19
|
+
});
|
|
20
|
+
UserLoanModel.belongsTo(InstituteModel, {
|
|
21
|
+
foreignKey: { name: 'instituteId', field: 'institute_id' },
|
|
22
|
+
as: 'institute',
|
|
23
|
+
});
|
|
24
|
+
UserLoanModel.belongsTo(AdditionalPayoutTypeModel, {
|
|
25
|
+
foreignKey: { name: 'additionalPayoutTypeId', field: 'additional_payout_type_id' },
|
|
26
|
+
as: 'additionalPayoutType',
|
|
27
|
+
});
|
|
28
|
+
UserLoanModel.belongsTo(AcademicCalendarModel, {
|
|
29
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
30
|
+
as: 'academicCalendar',
|
|
31
|
+
});
|
|
32
|
+
UserLoanModel.belongsTo(UserModel, {
|
|
33
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
34
|
+
as: 'user',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
UserLoanModel.init({
|
|
39
|
+
id: {
|
|
40
|
+
type: sequelize_1.DataTypes.UUID,
|
|
41
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
42
|
+
allowNull: false,
|
|
43
|
+
primaryKey: true,
|
|
44
|
+
},
|
|
45
|
+
userId: {
|
|
46
|
+
type: sequelize_1.DataTypes.UUID,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
field: 'user_id',
|
|
49
|
+
},
|
|
50
|
+
instituteId: {
|
|
51
|
+
type: sequelize_1.DataTypes.UUID,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
field: 'institute_id',
|
|
54
|
+
},
|
|
55
|
+
academicCalendarId: {
|
|
56
|
+
type: sequelize_1.DataTypes.UUID,
|
|
57
|
+
allowNull: true,
|
|
58
|
+
field: 'academic_calendar_id',
|
|
59
|
+
},
|
|
60
|
+
additionalPayoutTypeId: {
|
|
61
|
+
type: sequelize_1.DataTypes.UUID,
|
|
62
|
+
allowNull: true,
|
|
63
|
+
field: 'additional_payout_type_id',
|
|
64
|
+
},
|
|
65
|
+
amount: {
|
|
66
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
67
|
+
allowNull: true,
|
|
68
|
+
defaultValue: 0,
|
|
69
|
+
},
|
|
70
|
+
description: {
|
|
71
|
+
type: sequelize_1.DataTypes.STRING,
|
|
72
|
+
allowNull: true,
|
|
73
|
+
},
|
|
74
|
+
status: {
|
|
75
|
+
type: sequelize_1.DataTypes.STRING,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
defaultValue: 'DUE',
|
|
78
|
+
},
|
|
79
|
+
}, {
|
|
80
|
+
modelName: 'UserLoanModel',
|
|
81
|
+
tableName: 'user_loans',
|
|
82
|
+
timestamps: true,
|
|
83
|
+
paranoid: true,
|
|
84
|
+
sequelize: index_1.sequelize,
|
|
85
|
+
});
|
|
86
|
+
exports.default = UserLoanModel;
|
package/package.json
CHANGED