@kipicore/dbcore 1.1.162 → 1.1.164
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/20251219063336-add_acl_in_banner.d.ts +2 -0
- package/dist/db/psql/migrations/20251219063336-add_acl_in_banner.js +22 -0
- package/dist/db/psql/migrations/20251219063952-add_acl_in_EntityGroupModel.d.ts +2 -0
- package/dist/db/psql/migrations/20251219063952-add_acl_in_EntityGroupModel.js +22 -0
- package/dist/interfaces/bannerInterface.d.ts +1 -0
- package/dist/interfaces/entityGroupInterface.d.ts +1 -0
- package/dist/models/psql/bannerModel.d.ts +1 -0
- package/dist/models/psql/bannerModel.js +9 -0
- package/dist/models/psql/entityGroupModel.d.ts +1 -0
- package/dist/models/psql/entityGroupModel.js +14 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('banners');
|
|
4
|
+
if (!table.academic_calendar_id) {
|
|
5
|
+
await queryInterface.addColumn('banners', 'academic_calendar_id', {
|
|
6
|
+
type: Sequelize.UUID,
|
|
7
|
+
defaultValue: null,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
field: 'academic_calendar_id',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const down = async (queryInterface, Sequelize) => {
|
|
14
|
+
const table = await queryInterface.describeTable('banners');
|
|
15
|
+
if (table.academic_calendar_id) {
|
|
16
|
+
await queryInterface.removeColumn('banners', 'academic_calendar_id');
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
module.exports = {
|
|
20
|
+
up,
|
|
21
|
+
down,
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('entity_group');
|
|
4
|
+
if (!table.academic_calendar_id) {
|
|
5
|
+
await queryInterface.addColumn('entity_group', 'academic_calendar_id', {
|
|
6
|
+
type: Sequelize.UUID,
|
|
7
|
+
defaultValue: null,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
field: 'academic_calendar_id',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const down = async (queryInterface, Sequelize) => {
|
|
14
|
+
const table = await queryInterface.describeTable('entity_group');
|
|
15
|
+
if (table.academic_calendar_id) {
|
|
16
|
+
await queryInterface.removeColumn('entity_group', 'academic_calendar_id');
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
module.exports = {
|
|
20
|
+
up,
|
|
21
|
+
down,
|
|
22
|
+
};
|
|
@@ -19,6 +19,10 @@ class BannerModel extends sequelize_1.Model {
|
|
|
19
19
|
},
|
|
20
20
|
as: 'bannerInstitute',
|
|
21
21
|
});
|
|
22
|
+
BannerModel.belongsTo(index_1.AcademicCalendarModel, {
|
|
23
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
24
|
+
as: 'bannerAcaCal',
|
|
25
|
+
});
|
|
22
26
|
BannerModel.belongsTo(fileStorageModel_1.default, {
|
|
23
27
|
foreignKey: {
|
|
24
28
|
name: 'fileStorageId',
|
|
@@ -103,6 +107,11 @@ BannerModel.init({
|
|
|
103
107
|
type: sequelize_1.DataTypes.UUID,
|
|
104
108
|
allowNull: false,
|
|
105
109
|
},
|
|
110
|
+
academicCalendarId: {
|
|
111
|
+
type: sequelize_1.DataTypes.UUID,
|
|
112
|
+
field: 'academic_calendar_id',
|
|
113
|
+
allowNull: true,
|
|
114
|
+
},
|
|
106
115
|
status: {
|
|
107
116
|
type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.COMMAN_STATUS)),
|
|
108
117
|
allowNull: false,
|
|
@@ -6,7 +6,7 @@ const app_1 = require("../../constants/app");
|
|
|
6
6
|
const index_1 = require("./index");
|
|
7
7
|
class EntityGroupModel extends sequelize_1.Model {
|
|
8
8
|
static associate(models) {
|
|
9
|
-
const { UserModel, InstituteEntityModel } = models;
|
|
9
|
+
const { UserModel, InstituteEntityModel, AcademicCalendarModel } = models;
|
|
10
10
|
EntityGroupModel.belongsTo(UserModel, {
|
|
11
11
|
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
12
12
|
as: 'createdByUser',
|
|
@@ -27,6 +27,14 @@ class EntityGroupModel extends sequelize_1.Model {
|
|
|
27
27
|
foreignKey: { name: 'standardId', allowNull: true, field: 'standard_id' },
|
|
28
28
|
as: 'entityGroupStandard',
|
|
29
29
|
});
|
|
30
|
+
EntityGroupModel.belongsTo(AcademicCalendarModel, {
|
|
31
|
+
foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
|
|
32
|
+
as: 'academicEntityGroup',
|
|
33
|
+
});
|
|
34
|
+
AcademicCalendarModel.hasMany(EntityGroupModel, {
|
|
35
|
+
foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
|
|
36
|
+
as: 'entityGroupAcademic',
|
|
37
|
+
});
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
exports.EntityGroupModel = EntityGroupModel;
|
|
@@ -51,6 +59,11 @@ EntityGroupModel.init({
|
|
|
51
59
|
field: 'institute_id',
|
|
52
60
|
allowNull: true,
|
|
53
61
|
},
|
|
62
|
+
academicCalendarId: {
|
|
63
|
+
type: sequelize_1.DataTypes.UUID,
|
|
64
|
+
field: 'academic_calendar_id',
|
|
65
|
+
allowNull: true,
|
|
66
|
+
},
|
|
54
67
|
isDefault: {
|
|
55
68
|
type: sequelize_1.DataTypes.BOOLEAN,
|
|
56
69
|
defaultValue: false,
|
package/package.json
CHANGED