20 lines
638 B
TypeScript
20 lines
638 B
TypeScript
import mongoose from 'mongoose';
|
|
import db from '../db';
|
|
|
|
const MeasurementTemplateSchema = new mongoose.Schema({
|
|
first_id: mongoose.Schema.Types.ObjectId,
|
|
name: String,
|
|
version: Number,
|
|
parameters: [new mongoose.Schema({
|
|
name: String,
|
|
range: mongoose.Schema.Types.Mixed
|
|
} ,{ _id : false })]
|
|
}, {minimize: false}); // to allow empty objects
|
|
|
|
// changelog query helper
|
|
MeasurementTemplateSchema.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>>('measurement_template', MeasurementTemplateSchema); |