import mongoose from 'mongoose';
import db from '../db';

const MaterialGroupsSchema = new mongoose.Schema({
  name: {type: String, index: {unique: true}}
});

// changelog query helper
MaterialGroupsSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
  db.log(req, this);
  return this;
}

export default mongoose.model<any, mongoose.Model<any, any>>('material_groups', MaterialGroupsSchema);