You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const mongoose = require("mongoose");
|
|
|
|
|
|
|
|
|
|
|
|
const productSchema = new mongoose.Schema({
|
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
required: [true, "Product name is required!"]
|
|
|
|
},
|
|
|
|
description: {
|
|
|
|
type: String,
|
|
|
|
required: [true, "Description is required!"]
|
|
|
|
},
|
|
|
|
price: {
|
|
|
|
type: Number,
|
|
|
|
required: [true, "Price is required!"]
|
|
|
|
},
|
|
|
|
isActive: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
createdOn : {
|
|
|
|
type: Date,
|
|
|
|
default : new Date()
|
|
|
|
},
|
|
|
|
inventory: {
|
|
|
|
type: Number,
|
|
|
|
default: 1
|
|
|
|
},
|
|
|
|
image: {
|
|
|
|
imageName: String,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const Product = mongoose.model("products", productSchema);
|
|
|
|
|
|
|
|
module.exports = Product;
|