import sequelize from '../config/sequelize';
import DataTypes from 'sequelize';
import Officer from './officer';

export default sequelize.define('committees', {
  name: {
    type: DataTypes.STRING,
    allowNull: false,
    primaryKey: true,
  },
  description: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
}, {
  scopes: {
    name(name) {
      return { where: { name } };
    },
    active(date) {
      return {
        include: [{
          model: Officer.scope({ method: ['active', date] }),
        }],
      };
    },
  },
});

import sequelize from '../config/sequelize';
import DataTypes from 'sequelize';
import paginate from '../helpers/paginate';
import Officer from './officer';

export default sequelize.define('committees', {
  name: {
    type: DataTypes.STRING,
    allowNull: false,
    primaryKey: true,
  },
  description: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
}, {
  scopes: {
    name(name) {
      return { where: { name } };
    },
    active(date) {
      return {
        include: [{
          model: Officer.scope({ method: ['active', date] }),
        }],
      };
    },
    paginate,
  },
});

Revert "Testing out removing pagination from Committees"
Revert "Testing out removing pagination from Committees"

This reverts commit 6548533d20516b8cf9705db08cd7bb50bff5cf59.
