proposalpost.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 ProposalPost = db_1["default"].define('proposalpost', {
  17. id: {
  18. type: sequelize_1.DataTypes.INTEGER,
  19. primaryKey: true
  20. },
  21. created: sequelize_1.DataTypes.INTEGER,
  22. updated: sequelize_1.DataTypes.INTEGER,
  23. edition: sequelize_1.DataTypes.INTEGER,
  24. text: sequelize_1.DataTypes.TEXT
  25. });
  26. ProposalPost.findAllWithIncludes = function () {
  27. return this.findAll({
  28. include: [{ association: 'author', attributes: ['handle'] }]
  29. });
  30. };
  31. ProposalPost.findByIdWithIncludes = function (id, args) {
  32. return this.findByPk(id, __assign(__assign({}, args), { include: [{ association: 'author', attributes: ['handle'] }] }));
  33. };
  34. ProposalPost.findWithIncludes = function (args) {
  35. return this.findAll(__assign(__assign({}, args), { include: [{ association: 'author', attributes: ['handle'] }] }));
  36. };
  37. exports["default"] = ProposalPost;