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;