Archived
2
This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
definma-api/src/models/measurement_template.ts

20 lines
638 B
TypeScript
Raw Normal View History

2020-05-04 15:48:07 +02:00
import mongoose from 'mongoose';
2020-06-05 08:50:06 +02:00
import db from '../db';
2020-05-04 15:48:07 +02:00
const MeasurementTemplateSchema = new mongoose.Schema({
first_id: mongoose.Schema.Types.ObjectId,
2020-05-14 15:36:47 +02:00
name: String,
2020-05-14 12:31:57 +02:00
version: Number,
2020-06-05 08:50:06 +02:00
parameters: [new mongoose.Schema({
2020-05-04 15:48:07 +02:00
name: String,
range: mongoose.Schema.Types.Mixed
2020-06-05 08:50:06 +02:00
} ,{ _id : false })]
2020-05-04 15:48:07 +02:00
}, {minimize: false}); // to allow empty objects
2020-06-05 08:50:06 +02:00
// 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);