1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- "use strict";
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- exports.__esModule = true;
- var db_1 = require("../db");
- var sequelize_1 = require("sequelize");
- var Block = db_1["default"].define('block', {
- id: {
- type: sequelize_1.DataTypes.INTEGER,
- primaryKey: true
- },
- hash: sequelize_1.DataTypes.STRING,
- timestamp: sequelize_1.DataTypes.DATE,
- blocktime: sequelize_1.DataTypes.INTEGER
- });
- Block.findAllWithIncludes = function () {
- return this.findAll({
- include: [
- { model: db_1["default"].models.era },
- { model: db_1["default"].models.event },
- { association: 'validator' },
- ]
- });
- };
- Block.findByIdWithIncludes = function (id) {
- return this.findByPk(id, {
- include: [
- { model: db_1["default"].models.era },
- { model: db_1["default"].models.event },
- { association: 'validator' },
- ]
- });
- };
- Block.findWithIncludes = function (args) {
- return this.findAll(__assign(__assign({}, args), { include: [
- { model: db_1["default"].models.era },
- { model: db_1["default"].models.event },
- { association: 'validator' },
- ] }));
- };
- exports["default"] = Block;
|