rentease-backend/models/Expense.js

68 lines
1.4 KiB
JavaScript
Raw Normal View History

2026-03-15 12:37:31 +00:00
const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Expense = sequelize.define('Expense', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '支出ID'
},
date: {
type: DataTypes.DATE,
allowNull: false,
comment: '支出日期'
},
amount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
comment: '支出金额'
},
category: {
type: DataTypes.STRING(50),
allowNull: false,
comment: '支出类别'
},
remark: {
type: DataTypes.STRING(255),
allowNull: true,
comment: '备注'
},
2026-03-15 13:15:13 +00:00
operator: {
type: DataTypes.STRING(50),
allowNull: true,
comment: '经办人'
},
2026-03-15 12:37:31 +00:00
createBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '创建人ID'
},
createTime: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updateBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '修改人ID'
},
updateTime: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
onUpdate: DataTypes.NOW,
comment: '更新时间'
},
isDeleted: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '删除状态0未删除1已删除'
}
}, {
tableName: 'expenses',
timestamps: false
});
module.exports = Expense;