rentease-backend-new/models/Apartment.js

72 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-04-20 06:43:09 +00:00
const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Apartment = sequelize.define('Apartment', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '公寓ID'
},
name: {
type: DataTypes.STRING(100),
allowNull: false,
comment: '公寓名称'
},
address: {
type: DataTypes.STRING(200),
allowNull: true,
comment: '地址'
},
description: {
type: DataTypes.TEXT,
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: 'apartments',
timestamps: false,
comment: '公寓表'
});
module.exports = Apartment;