refactor: 统一代码风格并迁移至 ESLint 新配置
style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
This commit is contained in:
@@ -1,81 +1,81 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../db');
|
||||
|
||||
const InventoryTask = sequelize.define('InventoryTask', {
|
||||
taskId: {
|
||||
type: DataTypes.STRING,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
const InventoryTask = sequelize.define(
|
||||
'InventoryTask',
|
||||
{
|
||||
taskId: {
|
||||
type: DataTypes.STRING,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
planId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
targetType: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: 'room:机房, rack:机柜, device:设备',
|
||||
},
|
||||
targetId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '目标ID(机房ID/机柜ID/设备ID)',
|
||||
},
|
||||
targetName: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '目标名称',
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: 'pending',
|
||||
comment: 'pending:待执行, in_progress:进行中, completed:已完成, skipped:已跳过',
|
||||
},
|
||||
totalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '设备总数',
|
||||
},
|
||||
checkedDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '已盘点设备数',
|
||||
},
|
||||
normalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '正常设备数',
|
||||
},
|
||||
abnormalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '异常设备数',
|
||||
},
|
||||
assignedTo: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
},
|
||||
assignedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
completedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
remark: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
planId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
targetType: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: 'room:机房, rack:机柜, device:设备'
|
||||
},
|
||||
targetId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '目标ID(机房ID/机柜ID/设备ID)'
|
||||
},
|
||||
targetName: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '目标名称'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: 'pending',
|
||||
comment: 'pending:待执行, in_progress:进行中, completed:已完成, skipped:已跳过'
|
||||
},
|
||||
totalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '设备总数'
|
||||
},
|
||||
checkedDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '已盘点设备数'
|
||||
},
|
||||
normalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '正常设备数'
|
||||
},
|
||||
abnormalDevices: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '异常设备数'
|
||||
},
|
||||
assignedTo: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
assignedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true
|
||||
},
|
||||
completedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true
|
||||
},
|
||||
remark: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true
|
||||
{
|
||||
tableName: 'inventory_tasks',
|
||||
timestamps: true,
|
||||
indexes: [{ fields: ['planId'] }, { fields: ['status'] }, { fields: ['assignedTo'] }],
|
||||
}
|
||||
}, {
|
||||
tableName: 'inventory_tasks',
|
||||
timestamps: true,
|
||||
indexes: [
|
||||
{ fields: ['planId'] },
|
||||
{ fields: ['status'] },
|
||||
{ fields: ['assignedTo'] }
|
||||
]
|
||||
});
|
||||
);
|
||||
|
||||
module.exports = InventoryTask;
|
||||
|
||||
Reference in New Issue
Block a user