@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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -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
+ };
@@ -20,4 +20,6 @@ export interface IInstituteSubscriptionPlanModelAttributes extends IDefaultAttri
20
20
  endDate: Date;
21
21
  lastSubscriptionPlan?: string;
22
22
  additionalModuleList?: IModulePriceModelAttributes[];
23
+ usedFreeCourses?: number;
24
+ addedNumberOfSchool?: number;
23
25
  }
@@ -6,7 +6,7 @@ export interface ICondition {
6
6
  value?: string | number | boolean;
7
7
  }
8
8
  export interface IUsageRule {
9
- title: 'BATCH' | 'FEE' | 'STD';
9
+ title: 'BATCH' | 'FEE' | 'STD' | 'SUBJECT';
10
10
  entityIds: string[];
11
11
  limit?: number;
12
12
  usedCount?: number;
@@ -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: false,
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: false,
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;
@@ -106,6 +106,7 @@ UserHasCourseModel.init({
106
106
  walletTransactionId: {
107
107
  type: sequelize_1.DataTypes.STRING,
108
108
  allowNull: true,
109
+ field: 'wallet_transaction_id',
109
110
  },
110
111
  }, {
111
112
  modelName: 'UserHasCourseModel',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.526",
3
+ "version": "1.1.528",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",