@kipicore/dbcore 1.1.611 → 1.1.613

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,33 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ up: async (queryInterface, Sequelize) => {
4
+ const transaction = await queryInterface.sequelize.transaction();
5
+ try {
6
+ await queryInterface.removeColumn('rms_storage_racks', 'rack_type', { transaction });
7
+ await queryInterface.addColumn('rms_storage_racks', 'location_id', {
8
+ type: Sequelize.UUID,
9
+ allowNull: true,
10
+ }, { transaction });
11
+ await transaction.commit();
12
+ }
13
+ catch (err) {
14
+ await transaction.rollback();
15
+ throw err;
16
+ }
17
+ },
18
+ down: async (queryInterface, Sequelize) => {
19
+ const transaction = await queryInterface.sequelize.transaction();
20
+ try {
21
+ await queryInterface.removeColumn('rms_storage_racks', 'location_id', { transaction });
22
+ await queryInterface.addColumn('rms_storage_racks', 'rack_type', {
23
+ type: Sequelize.STRING,
24
+ allowNull: true
25
+ }, { transaction });
26
+ await transaction.commit();
27
+ }
28
+ catch (err) {
29
+ await transaction.rollback();
30
+ throw err;
31
+ }
32
+ }
33
+ };
@@ -9,6 +9,7 @@ export interface IRmsResourceDetailsDocument extends Document {
9
9
  resourceId: string;
10
10
  type: RMS_RESOURCE_TYPE;
11
11
  metadata: Record<string, any>;
12
+ imageIds?: string[];
12
13
  storageAllocations: IStorageAllocation[];
13
14
  createdBy?: string;
14
15
  updatedBy?: string;
@@ -1,10 +1,10 @@
1
1
  import { IDefaultAttributes } from './commonInterface';
2
- import { COMMAN_STATUS, RMS_RESOURCE_TYPE } from '../constants/app';
2
+ import { COMMAN_STATUS } from '../constants/app';
3
3
  export interface IRmsStorageRackAttributes extends IDefaultAttributes {
4
4
  id: string;
5
5
  instituteId: string;
6
6
  rackName: string;
7
- rackType: RMS_RESOURCE_TYPE;
7
+ locationId: string;
8
8
  description?: string | null;
9
9
  status: COMMAN_STATUS;
10
10
  }
@@ -45,6 +45,7 @@ const RmsResourceDetailsSchema = new mongoose_1.Schema({
45
45
  type: { type: String, required: true, enum: Object.values(constants_1.RMS_RESOURCE_TYPE) },
46
46
  metadata: { type: mongoose_1.Schema.Types.Mixed, required: true, default: {} },
47
47
  storageAllocations: { type: [StorageAllocationSchema], default: [] },
48
+ imageIds: { type: [String], default: [] },
48
49
  createdBy: { type: String, default: null },
49
50
  updatedBy: { type: String, default: null },
50
51
  deletedBy: { type: String, default: null },
@@ -1,12 +1,12 @@
1
1
  import { Model } from 'sequelize';
2
2
  import { IRmsStorageRackAttributes } from '../../interfaces/rmsStorageInterface';
3
3
  import { TRmsStorageRackCreationAttributes } from '../../types/rmsStorageType';
4
- import { COMMAN_STATUS, RMS_RESOURCE_TYPE } from '../../constants';
4
+ import { COMMAN_STATUS } from '../../constants';
5
5
  declare class RmsStorageRackModel extends Model<IRmsStorageRackAttributes, TRmsStorageRackCreationAttributes> implements IRmsStorageRackAttributes {
6
6
  id: string;
7
7
  instituteId: string;
8
8
  rackName: string;
9
- rackType: RMS_RESOURCE_TYPE;
9
+ locationId: string;
10
10
  description?: string | null;
11
11
  status: COMMAN_STATUS;
12
12
  createdBy?: string;
@@ -5,9 +5,11 @@ const index_1 = require("./index");
5
5
  const constants_1 = require("../../constants");
6
6
  class RmsStorageRackModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { InstituteModel, UserModel, RmsStorageSlotModel } = models;
8
+ const { InstituteModel, UserModel, RmsStorageSlotModel, RmsLocationModel } = models;
9
9
  RmsStorageRackModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
10
10
  InstituteModel.hasMany(RmsStorageRackModel, { foreignKey: 'instituteId', as: 'storageRacks' });
11
+ RmsStorageRackModel.belongsTo(RmsLocationModel, { foreignKey: 'locationId', as: 'location' });
12
+ RmsLocationModel.hasMany(RmsStorageRackModel, { foreignKey: 'locationId', as: 'storageRacks' });
11
13
  RmsStorageRackModel.hasMany(RmsStorageSlotModel, { foreignKey: 'rackId', as: 'slots' });
12
14
  RmsStorageRackModel.belongsTo(UserModel, { foreignKey: 'createdBy', as: 'createdByUser' });
13
15
  RmsStorageRackModel.belongsTo(UserModel, { foreignKey: 'updatedBy', as: 'updatedByUser' });
@@ -31,10 +33,10 @@ RmsStorageRackModel.init({
31
33
  allowNull: true,
32
34
  field: 'rack_name',
33
35
  },
34
- rackType: {
35
- type: sequelize_1.DataTypes.STRING,
36
+ locationId: {
37
+ type: sequelize_1.DataTypes.UUID,
36
38
  allowNull: true,
37
- field: 'rack_type',
39
+ field: 'location_id',
38
40
  },
39
41
  description: {
40
42
  type: sequelize_1.DataTypes.TEXT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.611",
3
+ "version": "1.1.613",
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",