12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- "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 Era = db_1["default"].define('era', {
- id: {
- type: sequelize_1.DataTypes.INTEGER,
- primaryKey: true
- },
- waiting: sequelize_1.DataTypes.INTEGER,
- active: sequelize_1.DataTypes.INTEGER,
- slots: sequelize_1.DataTypes.INTEGER,
- timestamp: sequelize_1.DataTypes.DATE,
- stake: sequelize_1.DataTypes.DECIMAL
- });
- Era.findAllWithIncludes = function () {
- return this.findAll({
- include: [
- {
- model: db_1["default"].models.block,
- attributes: ['id', 'blocktime', 'timestamp'],
- include: [
- {
- association: 'validator',
- attributes: ['key'],
- include: [
- { model: db_1["default"].models.member, attributes: ['id', 'handle'] },
- ]
- },
- { model: db_1["default"].models.event },
- ]
- },
- ]
- });
- };
- Era.findByIdWithIncludes = function (id) {
- return this.findByPk(id, {
- include: [
- {
- model: db_1["default"].models.block,
- attributes: ['id', 'blocktime', 'timestamp'],
- include: [
- {
- association: 'validator',
- attributes: ['key'],
- include: [
- { model: db_1["default"].models.member, attributes: ['id', 'handle'] },
- ]
- },
- { model: db_1["default"].models.event },
- ]
- },
- ]
- });
- };
- Era.findWithIncludes = function (args) {
- return this.findAll(__assign(__assign({}, args), { include: [
- {
- model: db_1["default"].models.block,
- attributes: ['id', 'blocktime', 'timestamp'],
- include: [
- {
- association: 'validator',
- attributes: ['key'],
- include: [
- { model: db_1["default"].models.member, attributes: ['id', 'handle'] },
- ]
- },
- { model: db_1["default"].models.event },
- ]
- },
- ] }));
- };
- exports["default"] = Era;
|