rentease-backend-new/models/Renter.js

72 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2026-04-20 06:43:09 +00:00
const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Renter = sequelize.define('Renter', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '租客ID'
},
name: {
type: DataTypes.STRING(50),
allowNull: false,
comment: '姓名'
},
phone: {
type: DataTypes.STRING(20),
allowNull: true,
comment: '电话'
},
idCard: {
type: DataTypes.STRING(18),
allowNull: true,
comment: '身份证号'
},
status: {
type: DataTypes.ENUM('active', 'inactive'),
allowNull: false,
defaultValue: 'active',
comment: '状态active-正常inactive-已退房'
},
tenantId: {
type: DataTypes.INTEGER,
allowNull: false,
comment: '租户ID'
},
createBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '创建人ID'
},
updateBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '修改人ID'
},
isDeleted: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '删除状态0未删除1已删除'
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updateTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'renters',
timestamps: false,
comment: '租客表'
});
module.exports = Renter;