You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.2 KiB
87 lines
2.2 KiB
'use strict';
|
|
|
|
module.exports = dc => {
|
|
const DataTypes = dc.ORM;
|
|
const sequelize = dc.orm;
|
|
|
|
const BillingPolicy = sequelize.define('billingPolicy', {
|
|
code: {
|
|
type: DataTypes.STRING(64),
|
|
allowNull: false,
|
|
primaryKey: true,
|
|
field: 'code',
|
|
comment: 'Policy code',
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING(128),
|
|
allowNull: false,
|
|
defaultValue: '',
|
|
field: 'name',
|
|
comment: 'Policy display name',
|
|
},
|
|
seedBidLimit: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 3,
|
|
field: 'seed_bid_limit',
|
|
comment: 'Permanent create quota for bid docs',
|
|
},
|
|
seedPlanLimit: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 3,
|
|
field: 'seed_plan_limit',
|
|
comment: 'Permanent create quota for plan docs',
|
|
},
|
|
rollingCreateLimit: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0,
|
|
field: 'rolling_create_limit',
|
|
comment: 'Rolling create quota after seed quota',
|
|
},
|
|
rollingCreateHours: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 24,
|
|
field: 'rolling_create_hours',
|
|
comment: 'Rolling create window in hours',
|
|
},
|
|
rewriteLimit: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 20,
|
|
field: 'rewrite_limit',
|
|
comment: 'Rewrite quota in each rewrite window',
|
|
},
|
|
rewriteWindowMinutes: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 60,
|
|
field: 'rewrite_window_minutes',
|
|
comment: 'Rewrite quota window in minutes',
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
|
field: 'created_at',
|
|
comment: 'Created at',
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
|
field: 'updated_at',
|
|
comment: 'Updated at',
|
|
},
|
|
}, {
|
|
tableName: 'billing_policy',
|
|
comment: 'Billing policy table',
|
|
timestamps: false,
|
|
indexes: [],
|
|
});
|
|
|
|
dc.models.BillingPolicy = BillingPolicy;
|
|
return BillingPolicy;
|
|
};
|
|
|