@kipicore/dbcore 1.1.295 → 1.1.296
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/20260226050211-delete_old_name.d.ts +2 -0
- package/dist/db/psql/migrations/20260226050211-delete_old_name.js +39 -0
- package/dist/db/psql/migrations/20260226050625-delete_old_name_1.d.ts +2 -0
- package/dist/db/psql/migrations/20260226050625-delete_old_name_1.js +37 -0
- package/dist/db/psql/seeders/Data/KipiStorageModule.js +8 -8
- package/dist/models/psql/lectureModel.js +14 -11
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
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: 'Kipi Storage',
|
|
9
|
+
updated_at: new Date(),
|
|
10
|
+
code: 'KIPI'
|
|
11
|
+
}, {
|
|
12
|
+
code: ' KIPI',
|
|
13
|
+
}, { transaction });
|
|
14
|
+
// Update module_features table
|
|
15
|
+
await queryInterface.bulkUpdate('module_features', {
|
|
16
|
+
name: 'Kipi Store Management',
|
|
17
|
+
updated_at: new Date(),
|
|
18
|
+
code: 'KIPI.STORAGE',
|
|
19
|
+
}, {
|
|
20
|
+
code: ' KIPI.STORAGE',
|
|
21
|
+
}, { transaction });
|
|
22
|
+
await transaction.commit();
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
await transaction.rollback();
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
async down(queryInterface) {
|
|
30
|
+
const transaction = await queryInterface.sequelize.transaction();
|
|
31
|
+
try {
|
|
32
|
+
await transaction.commit();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
await transaction.rollback();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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: 'Kipi Storage',
|
|
9
|
+
updated_at: new Date(),
|
|
10
|
+
}, {
|
|
11
|
+
code: 'KIPI'
|
|
12
|
+
}, { transaction });
|
|
13
|
+
// Update module_features table
|
|
14
|
+
await queryInterface.bulkUpdate('module_features', {
|
|
15
|
+
name: 'Kipi Store Management',
|
|
16
|
+
updated_at: new Date(),
|
|
17
|
+
}, {
|
|
18
|
+
code: 'KIPI.STORAGE',
|
|
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
|
+
await transaction.commit();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
await transaction.rollback();
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
3
3
|
const appTypeEnum = require('./appType');
|
|
4
4
|
const KipiStorageModule = {
|
|
5
|
-
name: '
|
|
6
|
-
code: '
|
|
5
|
+
name: 'Kipi Storage',
|
|
6
|
+
code: 'KIPI',
|
|
7
7
|
appType: [appTypeEnum.SCHOOL_APP],
|
|
8
8
|
features: [
|
|
9
9
|
{
|
|
10
|
-
name: '
|
|
11
|
-
code: '
|
|
10
|
+
name: 'Kipi Store Management',
|
|
11
|
+
code: 'KIPI.STORAGE',
|
|
12
12
|
appType: [appTypeEnum.SCHOOL_APP],
|
|
13
13
|
actions: [
|
|
14
|
-
{ name: 'Add', code: '
|
|
15
|
-
{ name: 'Update', code: '
|
|
16
|
-
{ name: 'View', code: '
|
|
17
|
-
{ name: 'Delete', code: '
|
|
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
18
|
],
|
|
19
19
|
},
|
|
20
20
|
],
|
|
@@ -91,22 +91,17 @@ class LectureModel extends sequelize_1.Model {
|
|
|
91
91
|
};
|
|
92
92
|
if (lecture.id)
|
|
93
93
|
where = { ...where, id: { [sequelize_1.Op.ne]: lecture.id } };
|
|
94
|
-
if (lecture.batchId) {
|
|
95
|
-
if (lecture.slotId)
|
|
96
|
-
where.slotId = lecture.slotId;
|
|
97
|
-
const batchConflict = await LectureModel.findOne({ where: { ...where, batchId: lecture.batchId }, ...options });
|
|
98
|
-
if (batchConflict)
|
|
99
|
-
throw new Error(errorMessages_1.LECTURE_ERROR_MESSAGES.BATCH_OCCUPIED);
|
|
100
|
-
}
|
|
101
94
|
if (lecture.classRoomId) {
|
|
102
|
-
const classRoomConflict = await LectureModel.findOne({
|
|
95
|
+
const classRoomConflict = await LectureModel.findOne({
|
|
96
|
+
where: { ...where, classRoomId: lecture.classRoomId },
|
|
97
|
+
...options,
|
|
98
|
+
});
|
|
103
99
|
if (classRoomConflict)
|
|
104
100
|
throw new Error(errorMessages_1.LECTURE_ERROR_MESSAGES.CLASSROOM_OCCUPIED);
|
|
105
101
|
}
|
|
106
|
-
// const teacherConflictWhere = omit(where, ['slotId']);
|
|
107
102
|
if (lecture.primaryUserId) {
|
|
108
103
|
const teacherConflict = await LectureModel.findOne({
|
|
109
|
-
where: { ...
|
|
104
|
+
where: { ...where, primaryUserId: lecture.primaryUserId },
|
|
110
105
|
...options,
|
|
111
106
|
});
|
|
112
107
|
if (teacherConflict)
|
|
@@ -114,12 +109,20 @@ class LectureModel extends sequelize_1.Model {
|
|
|
114
109
|
}
|
|
115
110
|
if (lecture.secondaryUserId) {
|
|
116
111
|
const teacherConflict = await LectureModel.findOne({
|
|
117
|
-
where: { ...
|
|
112
|
+
where: { ...where, secondaryUserId: lecture.secondaryUserId },
|
|
118
113
|
...options,
|
|
119
114
|
});
|
|
120
115
|
if (teacherConflict)
|
|
121
116
|
throw new Error(errorMessages_1.LECTURE_ERROR_MESSAGES.TEACHER_OCCUPIED);
|
|
122
117
|
}
|
|
118
|
+
if (lecture.batchId) {
|
|
119
|
+
if (lecture.slotId)
|
|
120
|
+
where.slotId = lecture.slotId;
|
|
121
|
+
const batchConflict = await LectureModel.findOne({ where: { ...where, batchId: lecture.batchId }, ...options });
|
|
122
|
+
if (batchConflict)
|
|
123
|
+
throw new Error(errorMessages_1.LECTURE_ERROR_MESSAGES.BATCH_OCCUPIED);
|
|
124
|
+
}
|
|
125
|
+
// const teacherConflictWhere = omit(where, ['slotId']);
|
|
123
126
|
}
|
|
124
127
|
if (lecture.batchId) {
|
|
125
128
|
const batchWhere = { id: lecture.batchId };
|
package/package.json
CHANGED