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

View File

@@ -0,0 +1,19 @@
const mongoose = require('mongoose');
const inventoryHistorySchema = new mongoose.Schema({
product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true },
sku: { type: String, required: true },
changeType: {
type: String,
enum: ['Order Placed', 'Order Cancelled', 'Manual Adjustment', 'Restock', 'Returned Product'],
required: true
},
quantityChanged: { type: Number, required: true }, // positive for addition, negative for deduction
previousStock: { type: Number, required: true },
newStock: { type: Number, required: true },
reason: { type: String, default: '' },
performedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User', default: null }
}, { timestamps: true });
module.exports = mongoose.model('InventoryHistory', inventoryHistorySchema);