Files
finanzas_api/models/ahorros.js
2022-10-02 08:03:49 -05:00

22 lines
589 B
JavaScript
Executable File

const mongoose = require('mongoose');
const {Schema} =mongoose;
const itemSchema = new Schema({
detalle:{type:String},
valor:{type:Number},
tipo:{type:String, required:true}
})
const AhorroSchema=new Schema({
date: {type: Date, default: Date.now},
nombreAhorro: {type:String,required:true},
detalleAhorro:{type:String,required:true},
datos:[itemSchema],
user:{type:String, required:true},
child:itemSchema
});
module.exports.Ahorro=mongoose.model('ahorro',AhorroSchema);
module.exports.itemAhorro=mongoose.model('itemAhorro',itemSchema);