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

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

// changelog query helper
NoteFieldSchema.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>>('note_field', NoteFieldSchema);