@kipicore/dbcore 1.1.527 → 1.1.529

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.
@@ -13,6 +13,11 @@ const up = async (queryInterface, Sequelize) => {
13
13
  allowNull: false,
14
14
  primaryKey: true,
15
15
  },
16
+ studentId: {
17
+ type: Sequelize.UUID,
18
+ field: 'student_id',
19
+ allowNull: true,
20
+ },
16
21
  certificateType: {
17
22
  type: Sequelize.STRING,
18
23
  field: 'certificate_type',
@@ -88,6 +93,11 @@ const up = async (queryInterface, Sequelize) => {
88
93
  allowNull: false,
89
94
  primaryKey: true,
90
95
  },
96
+ studentId: {
97
+ type: Sequelize.UUID,
98
+ field: 'student_id',
99
+ allowNull: true,
100
+ },
91
101
  certificateType: {
92
102
  type: Sequelize.STRING,
93
103
  field: 'certificate_type',
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('certificate_request');
4
+ if (!table.student_id) {
5
+ await queryInterface.addColumn('certificate_request', 'student_id', {
6
+ type: Sequelize.UUID,
7
+ allowNull: true,
8
+ field: 'student_id',
9
+ });
10
+ }
11
+ };
12
+ const down = async (queryInterface) => {
13
+ const table = await queryInterface.describeTable('certificate_request');
14
+ if (table.student_id) {
15
+ await queryInterface.removeColumn('certificate_request', 'student_id');
16
+ }
17
+ };
18
+ module.exports = {
19
+ up,
20
+ down,
21
+ };
@@ -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
+ };
@@ -3,6 +3,7 @@ import { IDefaultAttributes } from './commonInterface';
3
3
  export interface ICertificateRequestModelAttributes extends IDefaultAttributes {
4
4
  id: string;
5
5
  parentId: string;
6
+ studentId?: string;
6
7
  canceledBy: string;
7
8
  completedBy: string;
8
9
  instituteId?: string;
@@ -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
  }
@@ -5,6 +5,7 @@ import { CERTIFICATE_REQUEST_STATUS, CERTIFICATE_REQUEST_TYPE } from '../../cons
5
5
  declare class CertificateRequestModel extends Model<ICertificateRequestModelAttributes, TCertificateRequestCreationAttributes> {
6
6
  id: string;
7
7
  parentId: string;
8
+ studentId: string;
8
9
  canceledBy: string;
9
10
  completedBy: string;
10
11
  instituteId?: string;
@@ -53,6 +53,14 @@ class CertificateRequestModel extends sequelize_1.Model {
53
53
  foreignKey: { name: 'instituteId', field: 'institute_id' },
54
54
  as: 'instituteCertificateR',
55
55
  });
56
+ CertificateRequestModel.belongsTo(UserModel, {
57
+ foreignKey: { name: 'studentId', field: 'student_id' },
58
+ as: 'certificateRStudent',
59
+ });
60
+ UserModel.hasMany(CertificateRequestModel, {
61
+ foreignKey: { name: 'studentId', field: 'student_id' },
62
+ as: 'studentCertificateR',
63
+ });
56
64
  }
57
65
  }
58
66
  CertificateRequestModel.init({
@@ -62,6 +70,11 @@ CertificateRequestModel.init({
62
70
  allowNull: false,
63
71
  primaryKey: true,
64
72
  },
73
+ studentId: {
74
+ type: sequelize_1.DataTypes.UUID,
75
+ field: 'student_id',
76
+ allowNull: true,
77
+ },
65
78
  certificateType: {
66
79
  type: sequelize_1.DataTypes.STRING,
67
80
  field: 'certificate_type',
@@ -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.527",
3
+ "version": "1.1.529",
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",