Files
yunrui_asset/backend/models/Rack.js
T
zhang1106 a0ad9ad604 feat: 优化3D可视化性能并更新文档
- 实现3D可视化性能优化(降低DPR、阴影贴图、简化光源)
- 实现LOD多级细节系统,根据相机距离自动切换
- 添加设备弹出动画开关,默认关闭
- 修复设备缩放时位置偏移问题
- 更新README添加项目截图占位符
- 精简DEPLOYMENT.md文档,添加Gitee仓库支持
- 更新CHANGELOG.md记录v1.1.0版本
2026-01-26 17:21:20 +08:00

55 lines
1.1 KiB
JavaScript

const { DataTypes } = require('sequelize');
const { sequelize } = require('../db');
const Room = require('./Room');
const Rack = sequelize.define('Rack', {
rackId: {
type: DataTypes.STRING,
primaryKey: true,
allowNull: false,
unique: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
height: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 45 // 标准机柜高度(U数)
},
maxPower: {
type: DataTypes.FLOAT,
allowNull: false
},
currentPower: {
type: DataTypes.FLOAT,
defaultValue: 0
},
status: {
type: DataTypes.STRING,
defaultValue: 'active'
},
roomId: {
type: DataTypes.STRING,
allowNull: false,
references: {
model: Room,
key: 'roomId'
}
}
}, {
tableName: 'racks',
timestamps: true,
indexes: [
{ fields: ['roomId'] },
{ fields: ['status'] },
{ fields: ['roomId', 'status'] }
]
});
// 关联关系
Rack.belongsTo(Room, { foreignKey: 'roomId' });
Room.hasMany(Rack, { foreignKey: 'roomId' });
module.exports = Rack;