Properly indent all source files
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const ChangelogSchema = new mongoose.Schema({
|
||||
action: String,
|
||||
collection_name: String,
|
||||
conditions: mongoose.Schema.Types.Mixed,
|
||||
data: Object,
|
||||
user_id: mongoose.Schema.Types.ObjectId
|
||||
action: String,
|
||||
collection_name: String,
|
||||
conditions: mongoose.Schema.Types.Mixed,
|
||||
data: Object,
|
||||
user_id: mongoose.Schema.Types.ObjectId
|
||||
}, {minimize: false, strict: false});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('changelog', ChangelogSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('changelog', ChangelogSchema);
|
||||
|
@ -2,19 +2,19 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const ConditionTemplateSchema = 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 })]
|
||||
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
|
||||
ConditionTemplateSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('condition_template', ConditionTemplateSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('condition_template', ConditionTemplateSchema);
|
||||
|
@ -2,15 +2,15 @@ import db from '../db';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const HelpSchema = new mongoose.Schema({
|
||||
key: {type: String, index: {unique: true}},
|
||||
level: String,
|
||||
text: String
|
||||
key: {type: String, index: {unique: true}},
|
||||
level: String,
|
||||
text: String
|
||||
}, {minimize: false});
|
||||
|
||||
// changelog query helper
|
||||
HelpSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('help', HelpSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('help', HelpSchema);
|
||||
|
@ -4,20 +4,20 @@ import MaterialGroupsModel from '../models/material_groups';
|
||||
import db from '../db';
|
||||
|
||||
const MaterialSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}},
|
||||
supplier_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialSupplierModel},
|
||||
group_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialGroupsModel},
|
||||
properties: mongoose.Schema.Types.Mixed,
|
||||
numbers: [String],
|
||||
status: String
|
||||
name: {type: String, index: {unique: true}},
|
||||
supplier_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialSupplierModel},
|
||||
group_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialGroupsModel},
|
||||
properties: mongoose.Schema.Types.Mixed,
|
||||
numbers: [String],
|
||||
status: String
|
||||
}, {minimize: false});
|
||||
|
||||
// changelog query helper
|
||||
MaterialSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
MaterialSchema.index({supplier_id: 1});
|
||||
MaterialSchema.index({group_id: 1});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material', MaterialSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material', MaterialSchema);
|
||||
|
@ -2,13 +2,13 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const MaterialGroupsSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}}
|
||||
name: {type: String, index: {unique: true}}
|
||||
});
|
||||
|
||||
// changelog query helper
|
||||
MaterialGroupsSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_groups', MaterialGroupsSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_groups', MaterialGroupsSchema);
|
||||
|
@ -2,13 +2,13 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const MaterialSuppliersSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}}
|
||||
name: {type: String, index: {unique: true}}
|
||||
});
|
||||
|
||||
// changelog query helper
|
||||
MaterialSuppliersSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_suppliers', MaterialSuppliersSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_suppliers', MaterialSuppliersSchema);
|
||||
|
@ -2,19 +2,19 @@ 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 })]
|
||||
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;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_template', MaterialTemplateSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('material_template', MaterialTemplateSchema);
|
||||
|
@ -6,18 +6,18 @@ import db from '../db';
|
||||
|
||||
|
||||
const MeasurementSchema = new mongoose.Schema({
|
||||
sample_id: {type: mongoose.Schema.Types.ObjectId, ref: SampleModel},
|
||||
values: mongoose.Schema.Types.Mixed,
|
||||
measurement_template: {type: mongoose.Schema.Types.ObjectId, ref: MeasurementTemplateModel},
|
||||
status: String
|
||||
sample_id: {type: mongoose.Schema.Types.ObjectId, ref: SampleModel},
|
||||
values: mongoose.Schema.Types.Mixed,
|
||||
measurement_template: {type: mongoose.Schema.Types.ObjectId, ref: MeasurementTemplateModel},
|
||||
status: String
|
||||
}, {minimize: false});
|
||||
|
||||
// changelog query helper
|
||||
MeasurementSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
MeasurementSchema.index({sample_id: 1});
|
||||
MeasurementSchema.index({measurement_template: 1});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('measurement', MeasurementSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('measurement', MeasurementSchema);
|
||||
|
@ -2,19 +2,19 @@ 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 })]
|
||||
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;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('measurement_template', MeasurementTemplateSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('measurement_template', MeasurementTemplateSchema);
|
||||
|
@ -2,19 +2,19 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const ModelSchema = new mongoose.Schema({
|
||||
group: {type: String, index: {unique: true}},
|
||||
models: [new mongoose.Schema({
|
||||
name: String,
|
||||
url: String,
|
||||
label: String
|
||||
} ,{ _id : true })]
|
||||
group: {type: String, index: {unique: true}},
|
||||
models: [new mongoose.Schema({
|
||||
name: String,
|
||||
url: String,
|
||||
label: String
|
||||
} ,{ _id : true })]
|
||||
});
|
||||
|
||||
// changelog query helper
|
||||
ModelSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
ModelSchema.index({group: 1});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('model', ModelSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('model', ModelSchema);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const ModelFileSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}},
|
||||
data: Buffer
|
||||
name: {type: String, index: {unique: true}},
|
||||
data: Buffer
|
||||
});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('model_file', ModelFileSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('model_file', ModelFileSchema);
|
||||
|
@ -2,18 +2,18 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const NoteSchema = new mongoose.Schema({
|
||||
comment: String,
|
||||
sample_references: [{
|
||||
sample_id: mongoose.Schema.Types.ObjectId,
|
||||
relation: String
|
||||
}],
|
||||
custom_fields: mongoose.Schema.Types.Mixed
|
||||
comment: String,
|
||||
sample_references: [{
|
||||
sample_id: mongoose.Schema.Types.ObjectId,
|
||||
relation: String
|
||||
}],
|
||||
custom_fields: mongoose.Schema.Types.Mixed
|
||||
});
|
||||
|
||||
// changelog query helper
|
||||
NoteSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('note', NoteSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('note', NoteSchema);
|
||||
|
@ -2,14 +2,14 @@ import mongoose from 'mongoose';
|
||||
import db from '../db';
|
||||
|
||||
const NoteFieldSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}},
|
||||
qty: Number
|
||||
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;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('note_field', NoteFieldSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('note_field', NoteFieldSchema);
|
||||
|
@ -6,24 +6,24 @@ import UserModel from './user';
|
||||
import db from '../db';
|
||||
|
||||
const SampleSchema = new mongoose.Schema({
|
||||
number: {type: String, index: {unique: true}},
|
||||
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: String
|
||||
number: {type: String, index: {unique: true}},
|
||||
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: String
|
||||
}, {minimize: false});
|
||||
|
||||
// changelog query helper
|
||||
SampleSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
SampleSchema.index({material_id: 1});
|
||||
SampleSchema.index({note_id: 1});
|
||||
SampleSchema.index({user_id: 1});
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('sample', SampleSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('sample', SampleSchema);
|
||||
|
@ -3,21 +3,21 @@ import db from '../db';
|
||||
import ModelModel from './model';
|
||||
|
||||
const UserSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}},
|
||||
email: String,
|
||||
pass: String,
|
||||
key: String,
|
||||
level: String,
|
||||
location: String,
|
||||
devices: [String],
|
||||
models: [{type: mongoose.Schema.Types.ObjectId, ref: ModelModel}],
|
||||
status: String
|
||||
name: {type: String, index: {unique: true}},
|
||||
email: String,
|
||||
pass: String,
|
||||
key: String,
|
||||
level: String,
|
||||
location: String,
|
||||
devices: [String],
|
||||
models: [{type: mongoose.Schema.Types.ObjectId, ref: ModelModel}],
|
||||
status: String
|
||||
});
|
||||
|
||||
// changelog query helper
|
||||
UserSchema.query.log = function <Q extends mongoose.DocumentQuery<any, any>> (req) {
|
||||
db.log(req, this);
|
||||
return this;
|
||||
db.log(req, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('user', UserSchema);
|
||||
export default mongoose.model<any, mongoose.Model<any, any>>('user', UserSchema);
|
||||
|
Reference in New Issue
Block a user