Initial commit

This commit is contained in:
2026-09-16 17:36:46 +05:30
commit c9f429d123
117 changed files with 14145 additions and 0 deletions

20
server/models/Cart.js Normal file
View File

@@ -0,0 +1,20 @@
const mongoose = require('mongoose');
const cartItemSchema = new mongoose.Schema({
product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true },
variantColor: { type: String, default: '' },
variantFinish: { type: String, default: '' },
quantity: { type: Number, required: true, default: 1, min: 1 },
price: { type: Number, required: true }
});
const cartSchema = new mongoose.Schema({
user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', default: null },
sessionId: { type: String, default: null },
items: [cartItemSchema],
couponCode: { type: String, default: '' },
discountAmount: { type: Number, default: 0 }
}, { timestamps: true });
module.exports = mongoose.model('Cart', cartSchema);