event.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 Event = db_1["default"].define('event', {
  17. section: sequelize_1.DataTypes.STRING,
  18. method: sequelize_1.DataTypes.STRING,
  19. data: sequelize_1.DataTypes.TEXT
  20. });
  21. Event.findAllWithIncludes = function () {
  22. return this.findAll({
  23. include: [
  24. { model: db_1["default"].models.block, include: [{ association: 'validator' }] },
  25. ]
  26. });
  27. };
  28. Event.findByIdWithIncludes = function (id, args) {
  29. return this.findByPk(id, __assign(__assign({}, args), { include: [
  30. { model: db_1["default"].models.block, include: [{ association: 'validator' }] },
  31. ] }));
  32. };
  33. Event.findWithIncludes = function (args) {
  34. return this.findAll(__assign(__assign({}, args), { include: [
  35. { model: db_1["default"].models.block, include: [{ association: 'validator' }] },
  36. ] }));
  37. };
  38. exports["default"] = Event;