separated groups and suppliers for material GET
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
import mongoose from 'mongoose';
|
||||
import MaterialSupplierModel from '../models/material_suppliers';
|
||||
import MaterialGroupsModel from '../models/material_groups';
|
||||
|
||||
const MaterialSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}},
|
||||
supplier: String,
|
||||
group: String,
|
||||
supplier_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialSupplierModel},
|
||||
group_id: {type: mongoose.Schema.Types.ObjectId, ref: MaterialGroupsModel},
|
||||
mineral: String,
|
||||
glass_fiber: String,
|
||||
carbon_fiber: String,
|
||||
|
7
src/models/material_groups.ts
Normal file
7
src/models/material_groups.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const MaterialGroupsSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}}
|
||||
});
|
||||
|
||||
export default mongoose.model('material_groups', MaterialGroupsSchema);
|
7
src/models/material_suppliers.ts
Normal file
7
src/models/material_suppliers.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const MaterialSuppliersSchema = new mongoose.Schema({
|
||||
name: {type: String, index: {unique: true}}
|
||||
});
|
||||
|
||||
export default mongoose.model('material_suppliers', MaterialSuppliersSchema);
|
Reference in New Issue
Block a user