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.
34 lines
522 B
JavaScript
34 lines
522 B
JavaScript
12 months ago
|
const mongoose = require("mongoose");
|
||
|
const Schema = mongoose.Schema;
|
||
|
|
||
|
// Schema/Blueprint
|
||
|
const productSchema = new Schema({
|
||
|
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
|
||
|
description: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
|
||
|
price : {
|
||
|
type: Number,
|
||
|
required: true,
|
||
|
},
|
||
|
|
||
|
isActive: {
|
||
|
type: Boolean,
|
||
|
default: true, // Assuming new users are not admins by default
|
||
|
},
|
||
|
|
||
|
createdOn:{
|
||
|
type:Date,
|
||
|
default: new Date()
|
||
|
},
|
||
|
|
||
|
|
||
|
});
|
||
|
module.exports = mongoose.model('Product', productSchema);
|