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/material_template.ts

20 lines
626 B
TypeScript
Raw Normal View History

2020-07-15 13:11:33 +02:00
import mongoose from 'mongoose';
import db from '../db';
const MaterialTemplateSchema = 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
MaterialTemplateSchema.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_template', MaterialTemplateSchema);