text: 'use strict';
  const {
      Model
  } = require( 'sequelize' );
  module.exports = ( sequelize, DataTypes ) => {
      class CandidateModel extends Model {
          /**
           * Helper method for defining associations.
           * This method is not a part of Sequelize lifecycle.
           * The `models/index` file will call this method automatically.
           */
          static associate ( models ) {
              // define association here
              this.belongsTo( models.Elections, {
                  as: 'election',
                  foreignKey: 'election_id',
                  constraints: false
              } );
              this.belongsTo( models.Posts, {
                  as: 'post',
                  foreignKey: 'post_id',
                  constraints: false
              } );
          }
      };
      CandidateModel.init( {
          firstname: {
              type: DataTypes.STRING,
              allowNull: false
          },
          lastname: {
              type: DataTypes.STRING,
              allowNull: false
          },
          matric: {
              type: DataTypes.STRING,
              allowNull: false
          },
          department: {
              type: DataTypes.STRING,
              allowNull: false
          },
          picture: {
              type: DataTypes.STRING,
              allowNull: false
          }
      }, {
          sequelize,
          modelName: 'Candidates',
          underscored: true
      } );
      return CandidateModel;
  };
  