Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
// 缓存的插件列表
plugins: {
type: Sequelize.STRING
},
// 缓存查询结果
output: {
type: Sequelize.JSON
},
// 生成缓存的时间
cacheAt: {
type: Sequelize.DATE,
defaultValue: Sequelize.NOW
}
}
const options = {
indexes: [
{
fields: ['words']
},
{
fields: [
{
attribute: 'count',
order: 'DESC'
}
]
},
defaultValue: false
},
json: {
type: Sequelize.JSONB,
allowNull: false,
get: deserializeJson('json')
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW()
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW()
}
}, {
scopes: {
userId: userId => ({
include: [{
model: User,
where: {id: userId},
through: {
attributes: [] // prevents association table from being included in the result
}
}]
})
},
instanceMethods: {
setJson: function (path, value) {
if (db.getDialect() === 'postgres') {
comment: '驳回,或者文章审核不通过的原因',
field: 'rejection_reason'
},
like_count: {
// 喜欢数
type: Seq.BIGINT(20),
comment: '喜欢数',
field: 'like_count',
defaultValue: 0
},
update_date: {
// 更新时间
type: Seq.DATE,
comment: '更新时间',
field: 'update_date',
defaultValue: Seq.NOW /* 时间 */
},
...time.create_date
}
}
type: Sequelize.INTEGER(11).UNSIGNED,
primaryKey: true,
allowNull: false,
field: 'member_id'
},
postId: {
type: Sequelize.INTEGER(11).UNSIGNED,
primaryKey: true,
allowNull: false,
field: 'post_id'
},
lastUpdatedAt: {
type: Sequelize.DATE,
defaultValue: Sequelize.NOW,
field: 'last_updated_at'
}
}, {
getterMethods: {
},
setterMethods: {
},
classMethods: {
},
* R-생성요청 - 게시판 생성을 요청하는 곳이다.
*/
type: {
type: Sequelize.ENUM('N', 'C', 'T','R'),
allowNull: false,
},
companyId: {
type: Sequelize.INTEGER(11).UNSIGNED,
field: 'company_id'
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
field: 'created_at'
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
field: 'updated_at'
},
openingAt: {
type: Sequelize.DATE,
field: 'opening_at'
},
closingAt: {
var Sequelize = require('sequelize');
var base64Img = require('base64-img');
var config = require('config');
var sequelize = new Sequelize(config.Database.uri, {logging: config.Database.logging});
var Image = sequelize.define('image', {
id: {type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true},
hash: Sequelize.STRING(32),
count: {type: Sequelize.INTEGER, defaultValue: 0},
url: Sequelize.STRING,
filename: {type: Sequelize.STRING(42), unique: true},
date: {type: Sequelize.DATE, defaultValue: Sequelize.NOW},
nsfw: {type: Sequelize.INTEGER}
},{
instanceMethods: {
b64: function() {
return base64Img.base64Sync(config.AppServer.images + '/' + this.filename);
}
}
})
var Account = sequelize.define('account', {
id: {type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true},
username: Sequelize.STRING,
password: Sequelize.STRING,
information: Sequelize.STRING,
protocol: Sequelize.STRING,
parser: Sequelize.STRING,
companyId: {
type: Sequelize.INTEGER(11).UNSIGNED,
field: 'company_id'
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
field: 'created_at'
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
field: 'updated_at'
},
openingAt: {
type: Sequelize.DATE,
field: 'opening_at'
},
closingAt: {
type: Sequelize.DATE,
field: 'closing_at'
}
}, {
getterMethods: {
references: {
model: 'Peers',
key: 'id'
}
},
settlement_method_id: {
type: Sequelize.UUID,
references: {
model: 'SettlementMethods',
key: 'id'
}
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW
},
updated_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW
}
})
},
down: sequelize => {
export const OrderFactory = (
sequelize: Sequelize.Sequelize,
DataTypes: Sequelize.DataTypes
): OrderModel => {
const Order: OrderModel = sequelize.define(
'orders',
{
id: {
type: DataTypes.STRING,
autoIncrement: true,
primaryKey: true
},
user: { type: DataTypes.STRING },
date: {
type: DataTypes.DATE,
defaultValue: Sequelize.NOW
}
}
);
Order.associate = (models): void => {
Order.belongsToMany(models.Item, {
through: 'orders_items',
as: 'items',
foreignKey: 'order_id'
})
};
return Order;
};
type: Sequelize.INTEGER,
allowNull: true
},
last_execution_successful: {
type: Sequelize.BOOLEAN,
allowNull: true
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW()
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW()
}
}, {
schema: db.schema,
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
instanceMethods: {
/**
* Never return the token in JSON.
*
* @override
* @returns {object}
*/
toJSON: function () {
const json = this.get({plain: true})
delete json.token