Last active
December 18, 2019 00:47
-
-
Save paulobunga/de8fd32e29d5936db3c7a6a8c0fe77e5 to your computer and use it in GitHub Desktop.
Product Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const ProductSchema = new Schema({ | |
name: { type: String, required: 'Name is required' }, | |
sale_price: { type: Number, required: 'Sale price is required' }, | |
cost_price: { type: Number, required: 'Cost price is required '}, | |
quantity: { type: Number, default: 0 } | |
}, { | |
timestamps: true | |
}); | |
module.exports = mongoose.model('Product', ProductSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment