adapted existing /sample methods to condition, removed /condition route
This commit is contained in:
@ -1,13 +0,0 @@
|
||||
import mongoose from 'mongoose';
|
||||
import SampleModel from './sample';
|
||||
import TreatmentTemplateModel from './treatment_template';
|
||||
|
||||
const ConditionSchema = new mongoose.Schema({
|
||||
sample_id: {type: mongoose.Schema.Types.ObjectId, ref: SampleModel},
|
||||
number: String,
|
||||
parameters: mongoose.Schema.Types.Mixed,
|
||||
treatment_template: {type: mongoose.Schema.Types.ObjectId, ref: TreatmentTemplateModel},
|
||||
status: Number
|
||||
});
|
||||
|
||||
export default mongoose.model('condition', ConditionSchema);
|
@ -1,13 +1,12 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const TreatmentTemplateSchema = new mongoose.Schema({
|
||||
const ConditionTemplateSchema = new mongoose.Schema({
|
||||
name: String,
|
||||
version: Number,
|
||||
number_prefix: String,
|
||||
parameters: [{
|
||||
name: String,
|
||||
range: mongoose.Schema.Types.Mixed
|
||||
}]
|
||||
}, {minimize: false}); // to allow empty objects
|
||||
|
||||
export default mongoose.model('treatment_template', TreatmentTemplateSchema);
|
||||
export default mongoose.model('condition_template', ConditionTemplateSchema);
|
@ -1,9 +1,11 @@
|
||||
import mongoose from 'mongoose';
|
||||
import ConditionModel from './condition';
|
||||
import SampleModel from './sample';
|
||||
import MeasurementTemplateModel from './measurement_template';
|
||||
|
||||
// TODO: change to sample_id
|
||||
|
||||
const MeasurementSchema = new mongoose.Schema({
|
||||
condition_id: {type: mongoose.Schema.Types.ObjectId, ref: ConditionModel},
|
||||
sample_id: {type: mongoose.Schema.Types.ObjectId, ref: SampleModel},
|
||||
values: mongoose.Schema.Types.Mixed,
|
||||
measurement_template: {type: mongoose.Schema.Types.ObjectId, ref: MeasurementTemplateModel},
|
||||
status: Number
|
||||
|
@ -3,7 +3,7 @@ import mongoose from 'mongoose';
|
||||
const NoteSchema = new mongoose.Schema({
|
||||
comment: String,
|
||||
sample_references: [{
|
||||
id: mongoose.Schema.Types.ObjectId,
|
||||
sample_id: mongoose.Schema.Types.ObjectId,
|
||||
relation: String
|
||||
}],
|
||||
custom_fields: mongoose.Schema.Types.Mixed
|
||||
|
@ -9,10 +9,11 @@ const SampleSchema = new mongoose.Schema({
|
||||
type: String,
|
||||
color: String,
|
||||
batch: String,
|
||||
condition: mongoose.Schema.Types.Mixed,
|
||||
material_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialModel},
|
||||
note_id: {type: mongoose.Schema.Types.ObjectId, ref: NoteModel},
|
||||
user_id: {type: mongoose.Schema.Types.ObjectId, ref: UserModel},
|
||||
status: Number
|
||||
});
|
||||
}, {minimize: false});
|
||||
|
||||
export default mongoose.model('sample', SampleSchema);
|
Reference in New Issue
Block a user