@kipicore/dbcore 1.1.291 → 1.1.293

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.
@@ -3,18 +3,18 @@
3
3
  const AcademicCalendarModule = require('./seeders/Data/AcademicCalendarModule');
4
4
  // const AdministrativeStaffModule = require('./seeders/Data/AdministrativeStaffModule');
5
5
  const AnnouncementsModule = require('./seeders/Data/AnnouncementsModule');
6
- // // const AssetsModule = require('./seeders/Data/AssetsModule');
6
+ // const AssetsModule = require('./seeders/Data/AssetsModule');
7
7
  const AttendanceModule = require('./seeders/Data/AttendanceModule');
8
8
  const BannerModule = require('./seeders/Data/BannerModule');
9
9
  const BatchModule = require('./seeders/Data/BatchModule');
10
10
  const DivisionModule = require('./seeders/Data/DivisionModule');
11
- const SchoolRegistration = require('./seeders/Data/SchoolRegistration');
11
+ // const SchoolRegistration = require('./seeders/Data/SchoolRegistration');
12
12
  // // const BoardModule = require('./seeders/Data/BoardModule ');
13
13
  const ClassroomModule = require('./seeders/Data/ClassroomModule');
14
14
  // const EventModule = require('./seeders/Data/EventModule');
15
15
  const ExamsAndResultsModule = require('./seeders/Data/ExamsAndResultsModule');
16
16
  const FeeAndDiscountModule = require('./seeders/Data/FeeAndDiscountModule');
17
- // // const FileModule = require('./seeders/Data/FileModule');
17
+ // const FileModule = require('./seeders/Data/FileModule');
18
18
  const InstituteModule = require('./seeders/Data/InstituteModule');
19
19
  const InventoryModule = require('./seeders/Data/InventoryModule');
20
20
  // // const ParentModule = require('./seeders/Data/ParentModule');
@@ -35,6 +35,7 @@ const IndexModule = require('./seeders/Data/IndexModule');
35
35
  const HolidayModule = require('./seeders/Data/HolidayModule');
36
36
  const EventModule = require('./seeders/Data/EventModule');
37
37
  const RoleModule = require('./seeders/Data/RoleModule');
38
+ const KipiStorageModule = require('./seeders/Data/KipiStorageModule');
38
39
  const ToDoModule = require('./seeders/Data/To-doModule');
39
40
  const HomeworkModule = require('./seeders/Data/HomeworkModule');
40
41
  const TestimonialsModule = require('./seeders/Data/TestimonialsModule');
@@ -67,7 +68,7 @@ const GreetingModule = require('./seeders/Data/greetingModule');
67
68
  const TaskManagementModule = require('./seeders/Data/taskManagementModule');
68
69
  const UserRoleModule = require('./seeders/Data/UserRoleModule');
69
70
  // const DashboardManagementModule = require('./seeders/Data/dashboardManagementModule'); // Need to uncomment dashboard module is ready
70
- // const CertificateManagementModule = require('./seeders/Data/certificateManagementModule'); // Need to uncomment certificate module is ready
71
+ const CertificateManagementModule = require('./seeders/Data/certificateManagementModule'); // Need to uncomment certificate module is ready
71
72
  const allModules = [
72
73
  AcademicCalendarModule,
73
74
  // AdministrativeStaffModule,
@@ -76,7 +77,8 @@ const allModules = [
76
77
  BannerModule,
77
78
  BatchModule,
78
79
  DivisionModule,
79
- SchoolRegistration,
80
+ KipiStorageModule,
81
+ // SchoolRegistration,
80
82
  // BoardModule,
81
83
  EventModule,
82
84
  ExamsAndResultsModule,
@@ -133,7 +135,7 @@ const allModules = [
133
135
  GreetingModule,
134
136
  TaskManagementModule,
135
137
  // DashboardManagementModule // Need to uncomment dashboard module is ready
136
- // CertificateManagementModule // Need to uncomment certificate module is ready
138
+ CertificateManagementModule, // Need to uncomment certificate module is ready
137
139
  UserRoleModule,
138
140
  ];
139
141
  module.exports = allModules;
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ async up(queryInterface) {
4
+ const transaction = await queryInterface.sequelize.transaction();
5
+ try {
6
+ // Update modules table
7
+ await queryInterface.bulkUpdate('modules', {
8
+ name: 'Homework & ClassWork',
9
+ updated_at: new Date(),
10
+ }, {
11
+ code: 'HOMEWORK',
12
+ }, { transaction });
13
+ // Update module_features table
14
+ await queryInterface.bulkUpdate('module_features', {
15
+ name: 'Homework & ClassWork Management',
16
+ updated_at: new Date(),
17
+ }, {
18
+ code: 'HOMEWORK.MANAGEMENT',
19
+ }, { transaction });
20
+ await transaction.commit();
21
+ }
22
+ catch (error) {
23
+ await transaction.rollback();
24
+ throw error;
25
+ }
26
+ },
27
+ async down(queryInterface) {
28
+ const transaction = await queryInterface.sequelize.transaction();
29
+ try {
30
+ // Revert modules table
31
+ await queryInterface.bulkUpdate('modules', {
32
+ name: 'HomeWork',
33
+ updated_at: new Date(),
34
+ }, {
35
+ code: 'HOMEWORK',
36
+ }, { transaction });
37
+ // Revert module_features table
38
+ await queryInterface.bulkUpdate('module_features', {
39
+ name: 'HomeWork Management',
40
+ updated_at: new Date(),
41
+ }, {
42
+ code: 'HOMEWORK.MANAGEMENT',
43
+ }, { transaction });
44
+ await transaction.commit();
45
+ }
46
+ catch (error) {
47
+ await transaction.rollback();
48
+ throw error;
49
+ }
50
+ },
51
+ };
@@ -104,34 +104,55 @@ module.exports = {
104
104
  if (newActions.length > 0) {
105
105
  await queryInterface.bulkInsert('feature_actions', newActions, { transaction });
106
106
  }
107
- // async function findOldCodes(queryInterface, table, validCodes) {
108
- // if (validCodes.length === 0) {
109
- // // If no codes in the new list, return all old ones
110
- // return (await queryInterface.sequelize.query(`SELECT code FROM ${table} WHERE is_default=true`, { raw: true ,transaction }))[0];
111
- // }
112
- // return (
113
- // await queryInterface.sequelize.query(`SELECT code FROM ${table} WHERE is_default=true AND code NOT IN (:codes)`, {
114
- // replacements: { codes: validCodes },
115
- // raw: true,
116
- // })
117
- // )[0];
107
+ // const modulesToDelete = existingModules.filter(m => !allModulesListCode.modules.has(m.code)).map(m => m.code);
108
+ // // Find features to delete
109
+ // const featuresToDelete = existingFeatures.filter(f => !allModulesListCode.features.has(f.code)).map(f => f.code);
110
+ // // Find actions to delete
111
+ // const actionsToDelete = existingActions.filter(a => !allModulesListCode.actions.has(a.code)).map(a => a.code);
112
+ // if (actionsToDelete.length) {
113
+ // await queryInterface.sequelize.query(`DELETE FROM feature_actions WHERE code IN (:codes)`, {
114
+ // replacements: { codes: actionsToDelete },
115
+ // transaction,
116
+ // });
118
117
  // }
118
+ // if (featuresToDelete.length) {
119
+ // await queryInterface.sequelize.query(`DELETE FROM module_features WHERE code IN (:codes)`, {
120
+ // replacements: { codes: featuresToDelete },
121
+ // transaction,
122
+ // });
123
+ // }
124
+ // if (modulesToDelete.length) {
125
+ // await queryInterface.sequelize.query(`DELETE FROM modules WHERE code IN (:codes)`, {
126
+ // replacements: { codes: modulesToDelete },
127
+ // transaction,
128
+ // });
129
+ // }
130
+ async function findOldCodes(queryInterface, table, validCodes) {
131
+ if (validCodes.length === 0) {
132
+ // If no codes in the new list, return all old ones
133
+ return (await queryInterface.sequelize.query(`SELECT code FROM ${table} WHERE is_default=true`, { raw: true, transaction }))[0];
134
+ }
135
+ return (await queryInterface.sequelize.query(`SELECT code FROM ${table} WHERE is_default=true AND code NOT IN (:codes)`, {
136
+ replacements: { codes: validCodes },
137
+ raw: true,
138
+ }))[0];
139
+ }
119
140
  // ✅ Delete old entries not in allModulesListCode
120
- await queryInterface.sequelize.query(`DELETE FROM feature_actions WHERE code NOT IN (:codes)`, {
121
- replacements: { codes: [...allModulesListCode.actions] },
122
- transaction,
123
- });
124
- await queryInterface.sequelize.query(`DELETE FROM module_features WHERE code NOT IN (:codes)`, {
125
- replacements: { codes: [...allModulesListCode.features] },
126
- transaction,
127
- });
128
- await queryInterface.sequelize.query(`DELETE FROM modules WHERE code NOT IN (:codes)`, {
129
- replacements: { codes: [...allModulesListCode.modules] },
130
- transaction,
131
- });
132
- // const oldActionsNotInNew = await findOldCodes(queryInterface, 'feature_actions', [...allModulesListCode.actions]);
133
- // const oldFeaturesNotInNew = await findOldCodes(queryInterface, 'module_features', [...allModulesListCode.features]);
134
- // const oldModulesNotInNew = await findOldCodes(queryInterface, 'modules', [...allModulesListCode.modules]);
141
+ // await queryInterface.sequelize.query(`DELETE FROM feature_actions WHERE code NOT IN (:codes)`, {
142
+ // replacements: { codes: [...allModulesListCode.actions] },
143
+ // transaction,
144
+ // });
145
+ // await queryInterface.sequelize.query(`DELETE FROM module_features WHERE code NOT IN (:codes)`, {
146
+ // replacements: { codes: [...allModulesListCode.features] },
147
+ // transaction,
148
+ // });
149
+ // await queryInterface.sequelize.query(`DELETE FROM modules WHERE code NOT IN (:codes)`, {
150
+ // replacements: { codes: [...allModulesListCode.modules] },
151
+ // transaction,
152
+ // });
153
+ await findOldCodes(queryInterface, 'feature_actions', [...allModulesListCode.actions]);
154
+ await findOldCodes(queryInterface, 'module_features', [...allModulesListCode.features]);
155
+ await findOldCodes(queryInterface, 'modules', [...allModulesListCode.modules]);
135
156
  // 2️⃣ Log them (or handle however you want)
136
157
  // console.log('🚨 Old Actions not in new list:', oldActionsNotInNew);
137
158
  // console.log('🚨 Old Features not in new list:', oldFeaturesNotInNew);
@@ -19,6 +19,16 @@ const AcademicCalendarModule = {
19
19
  { name: 'Approval', code: 'ACADEMICCALENDAR.ACADEMICYEAR.APPROVAL', appType: [appTypeEnum.INSTITUTE_APP, appTypeEnum.SCHOOL_APP] },
20
20
  ],
21
21
  },
22
+ {
23
+ name: 'Clone Data Management',
24
+ code: 'ACADEMICCALENDAR.CLONE',
25
+ appType: [appTypeEnum.SCHOOL_APP],
26
+ actions: [
27
+ { name: 'Add', code: 'ACADEMICCALENDAR.CLONE.ADD', appType: [appTypeEnum.SCHOOL_APP] },
28
+ { name: 'Update', code: 'ACADEMICCALENDAR.CLONE.UPDATE', appType: [appTypeEnum.SCHOOL_APP] },
29
+ { name: 'View', code: 'ACADEMICCALENDAR.CLONE.VIEW', appType: [appTypeEnum.SCHOOL_APP] },
30
+ ],
31
+ },
22
32
  ],
23
33
  };
24
34
  module.exports = AcademicCalendarModule;
@@ -54,6 +54,42 @@ const FeeAndDiscountModule = {
54
54
  // { name: 'Approval', code: 'FEE.MANAGEMENT.APPROVAL', appType: [appTypeEnum.SCHOOL_APP] },
55
55
  ],
56
56
  },
57
+ {
58
+ name: 'Assign Service Fees',
59
+ code: 'FEE.ASSIGNFEE',
60
+ appType: [appTypeEnum.SCHOOL_APP],
61
+ actions: [
62
+ { name: 'Add', code: 'FEE.ASSIGNFEE.ADD', appType: [appTypeEnum.SCHOOL_APP] },
63
+ { name: 'Update', code: 'FEE.ASSIGNFEE.UPDATE', appType: [appTypeEnum.SCHOOL_APP] },
64
+ { name: 'View', code: 'FEE.ASSIGNFEE.VIEW', appType: [appTypeEnum.SCHOOL_APP] },
65
+ { name: 'Delete', code: 'FEE.ASSIGNFEE.DELETE', appType: [appTypeEnum.SCHOOL_APP] },
66
+ // { name: 'Approval', code: 'FEE.MANAGEMENT.APPROVAL', appType: [appTypeEnum.SCHOOL_APP] },
67
+ ],
68
+ },
69
+ {
70
+ name: 'Fee Adjustment',
71
+ code: 'FEE.FEEADJUSTMENT',
72
+ appType: [appTypeEnum.SCHOOL_APP],
73
+ actions: [
74
+ { name: 'Add', code: 'FEE.FEEADJUSTMENT.ADD', appType: [appTypeEnum.SCHOOL_APP] },
75
+ { name: 'Update', code: 'FEE.FEEADJUSTMENT.UPDATE', appType: [appTypeEnum.SCHOOL_APP] },
76
+ { name: 'View', code: 'FEE.FEEADJUSTMENT.VIEW', appType: [appTypeEnum.SCHOOL_APP] },
77
+ { name: 'Delete', code: 'FEE.FEEADJUSTMENT.DELETE', appType: [appTypeEnum.SCHOOL_APP] },
78
+ // { name: 'Approval', code: 'FEE.MANAGEMENT.APPROVAL', appType: [appTypeEnum.SCHOOL_APP] },
79
+ ],
80
+ },
81
+ {
82
+ name: 'Fees Configuration',
83
+ code: 'FEE.CONFIGURATION',
84
+ appType: [appTypeEnum.SCHOOL_APP, appTypeEnum.INSTITUTE_APP],
85
+ actions: [
86
+ { name: 'Add', code: 'FEE.CONFIGURATION.ADD', appType: [appTypeEnum.SCHOOL_APP, appTypeEnum.INSTITUTE_APP] },
87
+ { name: 'Update', code: 'FEE.CONFIGURATION.UPDATE', appType: [appTypeEnum.SCHOOL_APP, appTypeEnum.INSTITUTE_APP] },
88
+ { name: 'View', code: 'FEE.CONFIGURATION.VIEW', appType: [appTypeEnum.SCHOOL_APP, appTypeEnum.INSTITUTE_APP] },
89
+ { name: 'Delete', code: 'FEE.CONFIGURATION.DELETE', appType: [appTypeEnum.SCHOOL_APP, appTypeEnum.INSTITUTE_APP] },
90
+ // { name: 'Approval', code: 'FEE.MANAGEMENT.APPROVAL', appType: [appTypeEnum.SCHOOL_APP] },
91
+ ],
92
+ },
57
93
  {
58
94
  name: 'Fees History',
59
95
  code: 'FEE.HISTORY',
@@ -2,12 +2,12 @@
2
2
  /* eslint-disable @typescript-eslint/no-require-imports */
3
3
  const appTypeEnum = require('./appType');
4
4
  const HomeworkModule = {
5
- name: 'Homework',
5
+ name: 'Homework & ClassWork',
6
6
  code: 'HOMEWORK',
7
7
  appType: [appTypeEnum.INSTITUTE_APP, appTypeEnum.SCHOOL_APP],
8
8
  features: [
9
9
  {
10
- name: 'Homework Management',
10
+ name: 'Homework & ClassWork Management',
11
11
  code: 'HOMEWORK.MANAGEMENT',
12
12
  appType: [appTypeEnum.INSTITUTE_APP, appTypeEnum.SCHOOL_APP],
13
13
  actions: [
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
3
+ const appTypeEnum = require('./appType');
4
+ const KipiStorageModule = {
5
+ name: 'Kip Storage',
6
+ code: ' KIPI',
7
+ appType: [appTypeEnum.SCHOOL_APP],
8
+ features: [
9
+ {
10
+ name: 'Kip Store Management',
11
+ code: ' KIPI.STORAGE',
12
+ appType: [appTypeEnum.SCHOOL_APP],
13
+ actions: [
14
+ { name: 'Add', code: ' KIPI.STORAGE.ADD', appType: [appTypeEnum.SCHOOL_APP] },
15
+ { name: 'Update', code: ' KIPI.STORAGE.UPDATE', appType: [appTypeEnum.SCHOOL_APP] },
16
+ { name: 'View', code: ' KIPI.STORAGE.VIEW', appType: [appTypeEnum.SCHOOL_APP] },
17
+ { name: 'Delete', code: ' KIPI.STORAGE.DELETE', appType: [appTypeEnum.SCHOOL_APP] },
18
+ ],
19
+ },
20
+ ],
21
+ };
22
+ module.exports = KipiStorageModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.291",
3
+ "version": "1.1.293",
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",
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // eslint-disable-next-line @typescript-eslint/no-require-imports
3
- const appTypeEnum = require('./appType');
4
- const TimetableModule = {
5
- name: 'School',
6
- code: 'SCHOOL',
7
- appType: [appTypeEnum.SCHOOL_APP],
8
- features: [
9
- {
10
- name: 'School Registration',
11
- code: 'SCHOOL.REGISTRATION',
12
- appType: [appTypeEnum.SCHOOL_APP],
13
- actions: [
14
- { name: 'Add', code: 'SCHOOL.REGISTRATION.ADD', appType: [appTypeEnum.SCHOOL_APP] },
15
- { name: 'Update', code: 'SCHOOL.REGISTRATION.UPDATE', appType: [appTypeEnum.SCHOOL_APP] },
16
- { name: 'View', code: 'SCHOOL.REGISTRATION.VIEW', appType: [appTypeEnum.SCHOOL_APP] },
17
- { name: 'Delete', code: 'SCHOOL.REGISTRATION.DELETE', appType: [appTypeEnum.SCHOOL_APP] },
18
- ],
19
- },
20
- ],
21
- };
22
- module.exports = TimetableModule;