rentease-backend-new/models/TenantResourceUsage.js

57 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const TenantResourceUsage = sequelize.define('TenantResourceUsage', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '记录ID'
},
tenantId: {
type: DataTypes.INTEGER,
allowNull: false,
comment: '租户ID'
},
recordDate: {
type: DataTypes.DATEONLY,
allowNull: false,
comment: '记录日期'
},
userCount: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '当日用户数'
},
apartmentCount: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '当日公寓数'
},
roomCount: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '当日房间数'
},
isOverLimit: {
type: DataTypes.TINYINT(1),
defaultValue: 0,
comment: '是否超额0-否1-是'
},
overageDetails: {
type: DataTypes.JSON,
allowNull: true,
comment: '超额详情JSON格式'
}
}, {
tableName: 'tenant_resource_usage',
timestamps: false,
indexes: [
{ fields: ['tenantId', 'recordDate'] },
{ fields: ['recordDate'] }
],
comment: '租户资源使用记录表'
});
module.exports = TenantResourceUsage;