@kipicore/dbcore 1.1.93 → 1.1.95

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.
@@ -1136,5 +1136,6 @@ export declare enum MAINTENANCE_ERROR_MESSAGES {
1136
1136
  GET_FAIL = "Unable to retrieve Maintenance data!",
1137
1137
  UPDATE_FAIL = "Unable to update Maintenance data!",
1138
1138
  DELETE_FAIL = "Unable to delete Maintenance data!",
1139
- NOT_FOUND = "Unable to find Maintenance data!"
1139
+ NOT_FOUND = "Unable to find Maintenance data!",
1140
+ EXISTS_MAINTENANCE = "is already exists for App."
1140
1141
  }
@@ -1260,4 +1260,5 @@ var MAINTENANCE_ERROR_MESSAGES;
1260
1260
  MAINTENANCE_ERROR_MESSAGES["UPDATE_FAIL"] = "Unable to update Maintenance data!";
1261
1261
  MAINTENANCE_ERROR_MESSAGES["DELETE_FAIL"] = "Unable to delete Maintenance data!";
1262
1262
  MAINTENANCE_ERROR_MESSAGES["NOT_FOUND"] = "Unable to find Maintenance data!";
1263
+ MAINTENANCE_ERROR_MESSAGES["EXISTS_MAINTENANCE"] = "is already exists for App.";
1263
1264
  })(MAINTENANCE_ERROR_MESSAGES || (exports.MAINTENANCE_ERROR_MESSAGES = MAINTENANCE_ERROR_MESSAGES = {}));
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
- const { type } = require('os');
3
2
  const up = async (queryInterface, Sequelize) => {
4
3
  const tableName = 'maintenance';
5
4
  const tableExists = await queryInterface
@@ -54,6 +53,11 @@ const up = async (queryInterface, Sequelize) => {
54
53
  field: 'entity_id',
55
54
  allowNull: true,
56
55
  },
56
+ appType: {
57
+ type: Sequelize.STRING,
58
+ field: 'app_type',
59
+ allowNull: true,
60
+ },
57
61
  createdBy: {
58
62
  type: Sequelize.UUID,
59
63
  allowNull: true,
@@ -135,6 +139,11 @@ const up = async (queryInterface, Sequelize) => {
135
139
  field: 'entity_id',
136
140
  allowNull: true,
137
141
  },
142
+ appType: {
143
+ type: Sequelize.STRING,
144
+ field: 'app_type',
145
+ allowNull: true,
146
+ },
138
147
  createdBy: {
139
148
  type: Sequelize.UUID,
140
149
  allowNull: true,
@@ -1,4 +1,4 @@
1
- import { MAINTENANCE_MODE, MAINTENANCE_MODULE_NAME, MAINTENANCE_TYPE } from '../constants';
1
+ import { APP_TYPE, MAINTENANCE_MODE, MAINTENANCE_MODULE_NAME, MAINTENANCE_TYPE } from '../constants';
2
2
  import { IDefaultAttributes } from './commonInterface';
3
3
  export interface IMaintenanceModelAttributes extends IDefaultAttributes {
4
4
  id: string;
@@ -10,4 +10,5 @@ export interface IMaintenanceModelAttributes extends IDefaultAttributes {
10
10
  moduleName?: MAINTENANCE_MODULE_NAME;
11
11
  instituteId?: string;
12
12
  entityId?: string;
13
+ appType: APP_TYPE;
13
14
  }
@@ -11,6 +11,7 @@ declare class MaintenanceModel extends Model<IMaintenanceModelAttributes, TIWork
11
11
  maintenanceTitle: string;
12
12
  maintenanceDescription: string;
13
13
  entityId?: string;
14
+ appType: string;
14
15
  static associate(models: any): void;
15
16
  }
16
17
  export default MaintenanceModel;
@@ -4,7 +4,7 @@ const sequelize_1 = require("sequelize");
4
4
  const index_1 = require("./index");
5
5
  class MaintenanceModel extends sequelize_1.Model {
6
6
  static associate(models) {
7
- const { UserModel, InstituteModel } = models;
7
+ const { UserModel, InstituteModel, InstituteEntityModel } = models;
8
8
  MaintenanceModel.belongsTo(UserModel, {
9
9
  foreignKey: {
10
10
  name: 'createdBy',
@@ -43,6 +43,20 @@ class MaintenanceModel extends sequelize_1.Model {
43
43
  },
44
44
  as: 'instituteMaintenance',
45
45
  });
46
+ MaintenanceModel.belongsTo(InstituteEntityModel, {
47
+ foreignKey: {
48
+ name: 'entityId',
49
+ field: 'entity_id',
50
+ },
51
+ as: 'maintenanceInstituteEntity',
52
+ });
53
+ InstituteEntityModel.hasMany(MaintenanceModel, {
54
+ foreignKey: {
55
+ name: 'entityId',
56
+ field: 'entity_id',
57
+ },
58
+ as: 'instituteEntityMaintenance',
59
+ });
46
60
  }
47
61
  }
48
62
  MaintenanceModel.init({
@@ -91,6 +105,11 @@ MaintenanceModel.init({
91
105
  field: 'entity_id',
92
106
  allowNull: true,
93
107
  },
108
+ appType: {
109
+ type: sequelize_1.DataTypes.STRING,
110
+ field: 'app_type',
111
+ allowNull: true,
112
+ }
94
113
  }, {
95
114
  modelName: 'MaintenanceModel',
96
115
  tableName: 'maintenance',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.93",
3
+ "version": "1.1.95",
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",