implemented first /sample methods
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/models/note.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/models/note.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
import mongoose from 'mongoose';
 | 
			
		||||
 | 
			
		||||
const NoteSchema = new mongoose.Schema({
 | 
			
		||||
  comment: String,
 | 
			
		||||
  sample_references: [{
 | 
			
		||||
    id: mongoose.Schema.Types.ObjectId,
 | 
			
		||||
    relation: String
 | 
			
		||||
  }],
 | 
			
		||||
  custom_fields: mongoose.Schema.Types.Mixed
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default mongoose.model('note', NoteSchema);
 | 
			
		||||
							
								
								
									
										8
									
								
								src/models/note_field.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/models/note_field.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
import mongoose from 'mongoose';
 | 
			
		||||
 | 
			
		||||
const NoteFieldSchema = new mongoose.Schema({
 | 
			
		||||
  name: {type: String, index: {unique: true}},
 | 
			
		||||
  qty: Number
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default mongoose.model('note_field', NoteFieldSchema);
 | 
			
		||||
							
								
								
									
										18
									
								
								src/models/sample.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/models/sample.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
import mongoose from 'mongoose';
 | 
			
		||||
 | 
			
		||||
import MaterialModel from './material';
 | 
			
		||||
import NoteModel from './note';
 | 
			
		||||
import UserModel from './user';
 | 
			
		||||
 | 
			
		||||
const SampleSchema = new mongoose.Schema({
 | 
			
		||||
  number: {type: String, index: {unique: true}},
 | 
			
		||||
  type: String,
 | 
			
		||||
  color: String,
 | 
			
		||||
  batch: String,
 | 
			
		||||
  validated: Boolean,
 | 
			
		||||
  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}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default mongoose.model('sample', SampleSchema);
 | 
			
		||||
		Reference in New Issue
	
	Block a user