@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.
- package/dist/db/psql/migrations/20260624000001-alter_rms_storage_racks_location_id.d.ts +2 -0
- package/dist/db/psql/migrations/20260624000001-alter_rms_storage_racks_location_id.js +33 -0
- package/dist/interfaces/rmsResourceDetailsInterface.d.ts +1 -0
- package/dist/interfaces/rmsStorageInterface.d.ts +2 -2
- package/dist/models/mongodb/rmsResourceDetailsModel.js +1 -0
- package/dist/models/psql/rmsStorageRackModel.d.ts +2 -2
- package/dist/models/psql/rmsStorageRackModel.js +6 -4
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IDefaultAttributes } from './commonInterface';
|
|
2
|
-
import { COMMAN_STATUS
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
35
|
-
type: sequelize_1.DataTypes.
|
|
36
|
+
locationId: {
|
|
37
|
+
type: sequelize_1.DataTypes.UUID,
|
|
36
38
|
allowNull: true,
|
|
37
|
-
field: '
|
|
39
|
+
field: 'location_id',
|
|
38
40
|
},
|
|
39
41
|
description: {
|
|
40
42
|
type: sequelize_1.DataTypes.TEXT,
|
package/package.json
CHANGED