councilstake.ts 679 B

12345678910111213141516171819202122232425262728
  1. import db from '../db'
  2. import { DataTypes } from 'sequelize'
  3. const Stake = db.define('consulstake', {
  4. stake: DataTypes.INTEGER,
  5. })
  6. Stake.findAllWithIncludes = function () {
  7. return this.findAll({
  8. include: [{ model: db.models.consul }, { model: db.models.member }],
  9. })
  10. }
  11. Stake.findByIdWithIncludes = function (id: number, args?: { where: any }) {
  12. return this.findByPk(id, {
  13. ...args,
  14. include: [{ model: db.models.consul }, { model: db.models.member }],
  15. })
  16. }
  17. Stake.findWithIncludes = function (args: { where: any }) {
  18. return this.findAll({
  19. ...args,
  20. include: [{ model: db.models.consul }, { model: db.models.member }],
  21. })
  22. }
  23. export default Stake