import db from '../db' import { DataTypes } from 'sequelize' const Commitment = db.define('commitment', { round: DataTypes.INTEGER, stake: DataTypes.INTEGER, vote: DataTypes.STRING }) Commitment.findAllWithIncludes = function () { return this.findAll({ include: [{ model: db.models.consul }, { model: db.models.member }], }) } Commitment.findByIdWithIncludes = function (id: number, args?: { where: any }) { return this.findByPk(id, { ...args, include: [{ model: db.models.consul }, { model: db.models.member }], }) } Commitment.findWithIncludes = function (args: { where: any }) { return this.findAll({ ...args, include: [{ model: db.models.consul }, { model: db.models.member }], }) } export default Commitment