proposalvote.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. var __assign = (this && this.__assign) || function () {
  3. __assign = Object.assign || function(t) {
  4. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5. s = arguments[i];
  6. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7. t[p] = s[p];
  8. }
  9. return t;
  10. };
  11. return __assign.apply(this, arguments);
  12. };
  13. exports.__esModule = true;
  14. var db_1 = require("../db");
  15. var sequelize_1 = require("sequelize");
  16. var ProposalVote = db_1["default"].define('proposalvote', {
  17. vote: sequelize_1.DataTypes.STRING
  18. });
  19. ProposalVote.findAllWithIncludes = function () {
  20. return this.findAll({
  21. include: [
  22. { model: db_1["default"].models.member, attributes: ['handle'] },
  23. { model: db_1["default"].models.consul },
  24. { model: db_1["default"].models.proposal, attributes: ['title'] },
  25. ]
  26. });
  27. };
  28. ProposalVote.findByIdWithIncludes = function (id, args) {
  29. return this.findByPk(id, __assign(__assign({}, args), { include: [
  30. { model: db_1["default"].models.member, attributes: ['handle'] },
  31. { model: db_1["default"].models.consul },
  32. { model: db_1["default"].models.proposal, attributes: ['title'] },
  33. ] }));
  34. };
  35. ProposalVote.findWithIncludes = function (args) {
  36. return this.findAll(__assign(__assign({}, args), { include: [
  37. { model: db_1["default"].models.member, attributes: ['handle'] },
  38. { model: db_1["default"].models.consul },
  39. { model: db_1["default"].models.proposal, attributes: ['title'] },
  40. ] }));
  41. };
  42. exports["default"] = ProposalVote;