12345678910111213141516171819202122232425262728293031323334 |
- import db from '../db'
- import { DataTypes } from 'sequelize'
- const Block = db.define('block', {
- id: {
- type: DataTypes.INTEGER,
- primaryKey: true,
- },
- timestamp: DataTypes.DATE,
- blocktime: DataTypes.INTEGER,
- })
- Block.findAllWithIncludes = function () {
- return this.findAll({
- include: [
- { model: db.models.era },
- { model: db.models.event },
- { association: 'author' },
- ],
- })
- }
- Block.findWithIncludes = function (args: { where: any }) {
- return this.findAll({
- ...args,
- include: [
- { model: db.models.era },
- { model: db.models.event },
- { association: 'author' },
- ],
- })
- }
- export default Block
|