@kipicore/dbcore 1.1.162 → 1.1.163

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.
@@ -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,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
+ };
@@ -11,5 +11,6 @@ export interface IBannerModelAttributes extends IDefaultAttributes {
11
11
  status: COMMAN_STATUS;
12
12
  fileStorageId: string;
13
13
  instituteId?: string;
14
+ academicCalendarId?: string;
14
15
  fileUrl?: string;
15
16
  }
@@ -12,6 +12,7 @@ export declare class BannerModel extends Model<IBannerModelAttributes, TBannerMo
12
12
  userType?: USER_TYPES;
13
13
  status: COMMAN_STATUS;
14
14
  fileStorageId: string;
15
+ academicCalendarId: string;
15
16
  instituteId: string;
16
17
  fileUrl?: string;
17
18
  createdBy: string;
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.162",
3
+ "version": "1.1.163",
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",