123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- "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 Member = db_1["default"].define('member', {
- id: {
- type: sequelize_1.DataTypes.INTEGER,
- primaryKey: true
- },
- createdAt: sequelize_1.DataTypes.INTEGER,
- handle: sequelize_1.DataTypes.STRING,
- about: sequelize_1.DataTypes.TEXT
- });
- Member.findAllWithIncludes = function () {
- return this.findAll({
- include: [
- { model: db_1["default"].models.post, include: [{ model: db_1["default"].models.thread }] },
- { model: db_1["default"].models.thread, include: [{ model: db_1["default"].models.category }] },
- { model: db_1["default"].models.proposal, include: [{ association: 'votes' }] },
- {
- model: db_1["default"].models.account,
- include: [
- { association: 'validated', attributes: ['id', 'timestamp'] },
- ]
- },
- {
- association: 'terms',
- include: [
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.proposal,
- include: [{ association: 'author' }]
- },
- ]
- },
- { association: 'voters', include: [{ model: db_1["default"].models.member }] },
- ]
- },
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.consul,
- include: [{ model: db_1["default"].models.member }]
- },
- ]
- },
- ]
- });
- };
- Member.findByIdWithIncludes = function (id, args) {
- return this.findByPk(id, __assign(__assign({}, args), { include: [
- { model: db_1["default"].models.post, include: [{ model: db_1["default"].models.thread }] },
- { model: db_1["default"].models.proposal, include: [{ association: 'votes' }] },
- {
- model: db_1["default"].models.account,
- include: [
- { association: 'validated', attributes: ['id', 'timestamp'] },
- ]
- },
- {
- association: 'terms',
- include: [
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.proposal,
- include: [{ association: 'author' }]
- },
- ]
- },
- { association: 'voters', include: [{ model: db_1["default"].models.member }] },
- ]
- },
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.consul,
- include: [{ model: db_1["default"].models.member }]
- },
- ]
- },
- ] }));
- };
- Member.findWithIncludes = function (args) {
- return this.findAll(__assign(__assign({}, args), { include: [
- { model: db_1["default"].models.post, include: [{ model: db_1["default"].models.thread }] },
- { model: db_1["default"].models.proposal, include: [{ association: 'votes' }] },
- {
- model: db_1["default"].models.account,
- include: [
- { association: 'validated', attributes: ['id', 'timestamp'] },
- ]
- },
- {
- association: 'terms',
- include: [
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.proposal,
- include: [{ association: 'author' }]
- },
- ]
- },
- { association: 'voters', include: [{ model: db_1["default"].models.member }] },
- ]
- },
- {
- association: 'votes',
- include: [
- {
- model: db_1["default"].models.consul,
- include: [{ model: db_1["default"].models.member }]
- },
- ]
- },
- {
- model: db_1["default"].models.account,
- include: [
- { association: 'validated', attributes: ['id', 'timestamp'] },
- ]
- },
- ] }));
- };
- exports["default"] = Member;
|