You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
780 B
47 lines
780 B
//En este modulo se declara la estructura de los datos que ingresaran a la BD
|
|
|
|
const mongoose = require("mongoose");
|
|
const Schema = mongoose.Schema;
|
|
|
|
const supplySchema = require("./../supplies/model");
|
|
|
|
const mySchema = new Schema({
|
|
name: {
|
|
type: String,
|
|
//required: true
|
|
},
|
|
products: [
|
|
{
|
|
type: Schema.ObjectId,
|
|
ref: "Supply",
|
|
},
|
|
],
|
|
order: [
|
|
{
|
|
idProduct: {
|
|
type: Schema.ObjectId,
|
|
ref: "Supply"
|
|
},
|
|
amount: {
|
|
type: Number,
|
|
},
|
|
date: {
|
|
type: Date
|
|
},
|
|
quantity: {
|
|
type: Number,
|
|
}
|
|
}
|
|
],
|
|
date: Date,
|
|
statusDB: {
|
|
type: Boolean,
|
|
required: false,
|
|
},
|
|
description: {
|
|
type: String,
|
|
},
|
|
});
|
|
|
|
const model = mongoose.model("Provider", mySchema);
|
|
module.exports = model;
|
|
|