"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 Proposal = db_1["default"].define('proposal', { id: { type: sequelize_1.DataTypes.INTEGER, primaryKey: true }, createdAt: sequelize_1.DataTypes.INTEGER, finalizedAt: sequelize_1.DataTypes.INTEGER, title: sequelize_1.DataTypes.STRING, type: sequelize_1.DataTypes.STRING, stage: sequelize_1.DataTypes.STRING, result: sequelize_1.DataTypes.STRING, executed: sequelize_1.DataTypes.STRING, parameters: sequelize_1.DataTypes.STRING, description: sequelize_1.DataTypes.TEXT }); Proposal.findAllWithIncludes = function () { return this.findAll({ include: [ { association: 'author', attributes: ['handle'] }, { association: 'posts', include: [{ association: 'author', attributes: ['handle'] }] }, { association: 'votes', attributes: ['id', 'vote'], include: [{ model: db_1["default"].models.member, attributes: ['id', 'handle'] }] }, ] }); }; Proposal.findByIdWithIncludes = function (id, args) { return this.findByPk(id, __assign(__assign({}, args), { include: [ { association: 'author', attributes: ['handle'] }, { association: 'posts', include: [{ association: 'author', attributes: ['handle'] }] }, { association: 'votes', attributes: ['id', 'vote'], include: [{ model: db_1["default"].models.member, attributes: ['id', 'handle'] }] }, ] })); }; Proposal.findWithIncludes = function (args) { return this.findAll(__assign(__assign({}, args), { include: [ { association: 'author', attributes: ['handle'] }, { association: 'posts', include: [{ association: 'author', attributes: ['handle'] }] }, { association: 'votes', attributes: ['id', 'vote'], include: [{ association: 'author', attributes: ['id', 'handle'] }] }, ] })); }; exports["default"] = Proposal;