@kipicore/dbcore 1.1.526 → 1.1.528
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/20260527110000-add_fields_in_institute_subscription_plan_and_user_has_course.d.ts +2 -0
- package/dist/db/psql/migrations/20260527110000-add_fields_in_institute_subscription_plan_and_user_has_course.js +65 -0
- package/dist/interfaces/instituteSubscriptionPlanInterface.d.ts +2 -0
- package/dist/interfaces/offerAndDiscountInterface.d.ts +1 -1
- package/dist/models/psql/instituteSubscriptionPlanModel.d.ts +2 -0
- package/dist/models/psql/instituteSubscriptionPlanModel.js +14 -2
- package/dist/models/psql/userHasCourseModel.d.ts +1 -0
- package/dist/models/psql/userHasCourseModel.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const instituteSubscriptionPlansTable = await queryInterface.describeTable('institute_subscription_plans');
|
|
4
|
+
if (!instituteSubscriptionPlansTable.used_free_courses) {
|
|
5
|
+
await queryInterface.addColumn('institute_subscription_plans', 'used_free_courses', {
|
|
6
|
+
type: Sequelize.INTEGER,
|
|
7
|
+
allowNull: true,
|
|
8
|
+
defaultValue: 0,
|
|
9
|
+
field: 'used_free_courses',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (!instituteSubscriptionPlansTable.added_number_of_school) {
|
|
13
|
+
await queryInterface.addColumn('institute_subscription_plans', 'added_number_of_school', {
|
|
14
|
+
type: Sequelize.INTEGER,
|
|
15
|
+
allowNull: true,
|
|
16
|
+
defaultValue: 0,
|
|
17
|
+
field: 'added_number_of_school',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
await queryInterface.changeColumn('institute_subscription_plans', 'user_id', {
|
|
21
|
+
type: Sequelize.UUID,
|
|
22
|
+
allowNull: true,
|
|
23
|
+
field: 'user_id',
|
|
24
|
+
});
|
|
25
|
+
await queryInterface.changeColumn('institute_subscription_plans', 'institute_id', {
|
|
26
|
+
type: Sequelize.UUID,
|
|
27
|
+
allowNull: true,
|
|
28
|
+
field: 'institute_id',
|
|
29
|
+
});
|
|
30
|
+
const userHasCoursesTable = await queryInterface.describeTable('userHasUserHasCourses');
|
|
31
|
+
if (!userHasCoursesTable.wallet_transaction_id) {
|
|
32
|
+
await queryInterface.addColumn('userHasUserHasCourses', 'wallet_transaction_id', {
|
|
33
|
+
type: Sequelize.STRING,
|
|
34
|
+
allowNull: true,
|
|
35
|
+
field: 'wallet_transaction_id',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const down = async (queryInterface, Sequelize) => {
|
|
40
|
+
const instituteSubscriptionPlansTable = await queryInterface.describeTable('institute_subscription_plans');
|
|
41
|
+
if (instituteSubscriptionPlansTable.used_free_courses) {
|
|
42
|
+
await queryInterface.removeColumn('institute_subscription_plans', 'used_free_courses');
|
|
43
|
+
}
|
|
44
|
+
if (instituteSubscriptionPlansTable.added_number_of_school) {
|
|
45
|
+
await queryInterface.removeColumn('institute_subscription_plans', 'added_number_of_school');
|
|
46
|
+
}
|
|
47
|
+
await queryInterface.changeColumn('institute_subscription_plans', 'user_id', {
|
|
48
|
+
type: Sequelize.UUID,
|
|
49
|
+
allowNull: false,
|
|
50
|
+
field: 'user_id',
|
|
51
|
+
});
|
|
52
|
+
await queryInterface.changeColumn('institute_subscription_plans', 'institute_id', {
|
|
53
|
+
type: Sequelize.UUID,
|
|
54
|
+
allowNull: false,
|
|
55
|
+
field: 'institute_id',
|
|
56
|
+
});
|
|
57
|
+
const userHasCoursesTable = await queryInterface.describeTable('userHasUserHasCourses');
|
|
58
|
+
if (userHasCoursesTable.wallet_transaction_id) {
|
|
59
|
+
await queryInterface.removeColumn('userHasUserHasCourses', 'wallet_transaction_id');
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
module.exports = {
|
|
63
|
+
up,
|
|
64
|
+
down,
|
|
65
|
+
};
|
|
@@ -23,6 +23,8 @@ declare class InstituteSubscriptionPlanModel extends Model<IInstituteSubscriptio
|
|
|
23
23
|
startDate: Date;
|
|
24
24
|
endDate: Date;
|
|
25
25
|
lastSubscriptionPlan?: string;
|
|
26
|
+
usedFreeCourses: number;
|
|
27
|
+
addedNumberOfSchool: number;
|
|
26
28
|
createdBy: string;
|
|
27
29
|
updatedBy: string;
|
|
28
30
|
deletedBy: string;
|
|
@@ -58,7 +58,7 @@ InstituteSubscriptionPlanModel.init({
|
|
|
58
58
|
},
|
|
59
59
|
userId: {
|
|
60
60
|
type: sequelize_1.DataTypes.UUID,
|
|
61
|
-
allowNull:
|
|
61
|
+
allowNull: true,
|
|
62
62
|
field: 'user_id',
|
|
63
63
|
},
|
|
64
64
|
userUuid: {
|
|
@@ -68,7 +68,7 @@ InstituteSubscriptionPlanModel.init({
|
|
|
68
68
|
},
|
|
69
69
|
instituteId: {
|
|
70
70
|
type: sequelize_1.DataTypes.UUID,
|
|
71
|
-
allowNull:
|
|
71
|
+
allowNull: true,
|
|
72
72
|
field: 'institute_id',
|
|
73
73
|
},
|
|
74
74
|
walletId: {
|
|
@@ -141,6 +141,18 @@ InstituteSubscriptionPlanModel.init({
|
|
|
141
141
|
allowNull: true,
|
|
142
142
|
field: 'additional_module_list',
|
|
143
143
|
},
|
|
144
|
+
usedFreeCourses: {
|
|
145
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
146
|
+
allowNull: true,
|
|
147
|
+
defaultValue: 0,
|
|
148
|
+
field: 'used_free_courses',
|
|
149
|
+
},
|
|
150
|
+
addedNumberOfSchool: {
|
|
151
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
152
|
+
allowNull: true,
|
|
153
|
+
defaultValue: 0,
|
|
154
|
+
field: 'added_number_of_school',
|
|
155
|
+
},
|
|
144
156
|
}, {
|
|
145
157
|
modelName: 'InstituteSubscriptionPlanModel',
|
|
146
158
|
tableName: 'institute_subscription_plans',
|
|
@@ -12,6 +12,7 @@ declare class UserHasCourseModel extends Model<IUserHasCourseModelAttributes, TU
|
|
|
12
12
|
expiryDate: Date;
|
|
13
13
|
status: COMMAN_STATUS;
|
|
14
14
|
courseStatus: USER_COURSE_STATUS;
|
|
15
|
+
walletTransactionId: string;
|
|
15
16
|
createdBy: string;
|
|
16
17
|
updatedBy: string;
|
|
17
18
|
deletedBy: string;
|
package/package.json
CHANGED