@kipicore/dbcore 1.1.201 → 1.1.203

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.
@@ -658,7 +658,8 @@ export declare enum EMAIL_TEMPLATES {
658
658
  PARENTS_CREDENTIALS_TEMPLATE = "parentCredentialsTemplate",
659
659
  STUDENT_CREDENTIALS_TEMPLATE = "studentCredentialsTemplate",
660
660
  COMMON_TEMPLATE = "commonTemplate",
661
- CONTACT_FEEDBACK_TEMPLATE = "contactFeedbackTemplate"
661
+ CONTACT_FEEDBACK_TEMPLATE = "contactFeedbackTemplate",
662
+ ADMIN_STAFF_VERIFICATION = "adminStaffVerification"
662
663
  }
663
664
  export declare enum PDF_TEMPLATES {
664
665
  FEE_INVOICE_TEMPLATE = "feeInvoiceTemplate",
@@ -804,6 +804,7 @@ var EMAIL_TEMPLATES;
804
804
  EMAIL_TEMPLATES["STUDENT_CREDENTIALS_TEMPLATE"] = "studentCredentialsTemplate";
805
805
  EMAIL_TEMPLATES["COMMON_TEMPLATE"] = "commonTemplate";
806
806
  EMAIL_TEMPLATES["CONTACT_FEEDBACK_TEMPLATE"] = "contactFeedbackTemplate";
807
+ EMAIL_TEMPLATES["ADMIN_STAFF_VERIFICATION"] = "adminStaffVerification";
807
808
  })(EMAIL_TEMPLATES || (exports.EMAIL_TEMPLATES = EMAIL_TEMPLATES = {}));
808
809
  var PDF_TEMPLATES;
809
810
  (function (PDF_TEMPLATES) {
@@ -1,2 +1,2 @@
1
1
  export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -1,28 +1,209 @@
1
- 'use strict';
1
+ "use strict";
2
2
  const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('school_fee_terms');
4
- if (!table.title) {
5
- await queryInterface.addColumn('school_fee_terms', 'title', {
6
- type: Sequelize.STRING,
7
- defaultValue: null,
8
- allowNull: true,
3
+ const tableName = 'school_fee_terms';
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
+ instituteId: {
17
+ type: Sequelize.UUID,
18
+ allowNull: true,
19
+ field: 'institute_id',
20
+ },
21
+ academicCalendarId: {
22
+ type: Sequelize.UUID,
23
+ allowNull: true,
24
+ field: 'academic_calendar_id',
25
+ },
26
+ stdId: {
27
+ type: Sequelize.UUID,
28
+ allowNull: true,
29
+ field: 'std_id',
30
+ },
31
+ feeTypeId: {
32
+ type: Sequelize.UUID,
33
+ allowNull: true,
34
+ field: 'fee_type_id',
35
+ },
36
+ frequency: {
37
+ type: Sequelize.STRING,
38
+ allowNull: true,
39
+ },
40
+ amount: {
41
+ type: Sequelize.INTEGER,
42
+ allowNull: true,
43
+ },
44
+ date: {
45
+ type: Sequelize.DATE,
46
+ allowNull: true,
47
+ },
48
+ oldId: {
49
+ type: Sequelize.UUID,
50
+ allowNull: true,
51
+ field: 'old_id',
52
+ },
53
+ termsDependedId: {
54
+ type: Sequelize.STRING,
55
+ allowNull: true,
56
+ field: 'terms_depended_id',
57
+ },
58
+ createdBy: {
59
+ type: Sequelize.UUID,
60
+ allowNull: true,
61
+ field: 'created_by',
62
+ },
63
+ updatedBy: {
64
+ type: Sequelize.UUID,
65
+ allowNull: true,
66
+ field: 'updated_by',
67
+ },
68
+ deletedBy: {
69
+ type: Sequelize.UUID,
70
+ allowNull: true,
71
+ field: 'deleted_by',
72
+ },
73
+ createdAt: {
74
+ type: Sequelize.DATE,
75
+ allowNull: false,
76
+ defaultValue: Sequelize.NOW,
77
+ field: 'created_at',
78
+ },
79
+ updatedAt: {
80
+ type: Sequelize.DATE,
81
+ allowNull: false,
82
+ defaultValue: Sequelize.NOW,
83
+ field: 'updated_at',
84
+ },
85
+ deletedAt: {
86
+ type: Sequelize.DATE,
87
+ allowNull: true,
88
+ field: 'deleted_at',
89
+ },
90
+ title: {
91
+ type: Sequelize.STRING,
92
+ allowNull: true,
93
+ field: 'title',
94
+ },
95
+ schoolFeeId: {
96
+ type: Sequelize.STRING,
97
+ allowNull: true,
98
+ field: 'school_fee_id',
99
+ },
9
100
  });
10
101
  }
11
- if (!table.school_fee_id) {
12
- await queryInterface.addColumn('school_fee_terms', 'school_fee_id', {
13
- type: Sequelize.UUID,
14
- defaultValue: null,
15
- allowNull: true,
16
- });
102
+ else {
103
+ const tableDefinition = await queryInterface.describeTable(tableName);
104
+ const columnsToAdd = {
105
+ instituteId: {
106
+ type: Sequelize.UUID,
107
+ allowNull: true,
108
+ field: 'institute_id',
109
+ },
110
+ academicCalendarId: {
111
+ type: Sequelize.UUID,
112
+ allowNull: true,
113
+ field: 'academic_calendar_id',
114
+ },
115
+ stdId: {
116
+ type: Sequelize.UUID,
117
+ allowNull: true,
118
+ field: 'std_id',
119
+ },
120
+ feeTypeId: {
121
+ type: Sequelize.UUID,
122
+ allowNull: true,
123
+ field: 'fee_type_id',
124
+ },
125
+ frequency: {
126
+ type: Sequelize.STRING,
127
+ allowNull: true,
128
+ },
129
+ amount: {
130
+ type: Sequelize.INTEGER,
131
+ allowNull: true,
132
+ },
133
+ date: {
134
+ type: Sequelize.DATE,
135
+ allowNull: true,
136
+ },
137
+ oldId: {
138
+ type: Sequelize.UUID,
139
+ allowNull: true,
140
+ field: 'old_id',
141
+ },
142
+ termsDependedId: {
143
+ type: Sequelize.STRING,
144
+ allowNull: true,
145
+ field: 'terms_depended_id',
146
+ },
147
+ createdBy: {
148
+ type: Sequelize.UUID,
149
+ allowNull: true,
150
+ field: 'created_by',
151
+ },
152
+ updatedBy: {
153
+ type: Sequelize.UUID,
154
+ allowNull: true,
155
+ field: 'updated_by',
156
+ },
157
+ deletedBy: {
158
+ type: Sequelize.UUID,
159
+ allowNull: true,
160
+ field: 'deleted_by',
161
+ },
162
+ createdAt: {
163
+ type: Sequelize.DATE,
164
+ allowNull: false,
165
+ defaultValue: Sequelize.NOW,
166
+ field: 'created_at',
167
+ },
168
+ updatedAt: {
169
+ type: Sequelize.DATE,
170
+ allowNull: false,
171
+ defaultValue: Sequelize.NOW,
172
+ field: 'updated_at',
173
+ },
174
+ deletedAt: {
175
+ type: Sequelize.DATE,
176
+ allowNull: true,
177
+ field: 'deleted_at',
178
+ },
179
+ title: {
180
+ type: Sequelize.STRING,
181
+ allowNull: true,
182
+ field: 'title',
183
+ },
184
+ schoolFeeId: {
185
+ type: Sequelize.STRING,
186
+ allowNull: true,
187
+ field: 'school_fee_id',
188
+ },
189
+ };
190
+ for (const column of Object.keys(columnsToAdd)) {
191
+ const columnToAdd = columnsToAdd[column];
192
+ const tableColumn = columnToAdd.field || column;
193
+ if (!tableDefinition[tableColumn]) {
194
+ await queryInterface.addColumn(tableName, tableColumn, columnToAdd);
195
+ }
196
+ }
17
197
  }
18
198
  };
19
- const down = async (queryInterface, Sequelize) => {
20
- const table = await queryInterface.describeTable('school_fee_terms');
21
- if (table.title) {
22
- await queryInterface.removeColumn('school_fee_terms', 'title');
23
- }
24
- if (table.school_fee_id) {
25
- await queryInterface.removeColumn('school_fee_terms', 'school_fee_id');
199
+ const down = async (queryInterface) => {
200
+ const tableName = 'school_fee_terms';
201
+ const tableExists = await queryInterface
202
+ .describeTable(tableName)
203
+ .then(() => true)
204
+ .catch(() => false);
205
+ if (tableExists) {
206
+ await queryInterface.dropTable(tableName);
26
207
  }
27
208
  };
28
209
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.201",
3
+ "version": "1.1.203",
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",