style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
40 lines
831 B
JavaScript
40 lines
831 B
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../db');
|
|
|
|
const ConsumableCategory = sequelize.define(
|
|
'ConsumableCategory',
|
|
{
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true,
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
unique: true,
|
|
comment: '分类名称',
|
|
},
|
|
description: {
|
|
type: DataTypes.STRING,
|
|
comment: '分类描述',
|
|
},
|
|
sortOrder: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 0,
|
|
comment: '排序顺序',
|
|
},
|
|
status: {
|
|
type: DataTypes.STRING,
|
|
defaultValue: 'active',
|
|
comment: '状态: active-启用, inactive-停用',
|
|
},
|
|
},
|
|
{
|
|
tableName: 'consumable_categories',
|
|
timestamps: true,
|
|
}
|
|
);
|
|
|
|
module.exports = ConsumableCategory;
|