Download src/models/InventoryLog.js from eznd/woods: direct link, hf CLI and curl.
- Browser
- Download file 949 Bytes
-
https://huggingface.co/spaces/eznd/woods/resolve/main/src/models/InventoryLog.js
- Command line
-
hf download hf://spaces/eznd/woods/src/models/InventoryLog.js
-
curl -L -o InventoryLog.js https://huggingface.co/spaces/eznd/woods/resolve/main/src/models/InventoryLog.js
949 Bytes
| import mongoose from 'mongoose'; | |
| // Track inventory adjustments for audit trail | |
| const inventoryLogSchema = new mongoose.Schema({ | |
| product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true }, | |
| type: { | |
| type: String, | |
| enum: ['restock', 'sale', 'adjustment', 'return', 'damage', 'scan'], | |
| required: true, | |
| }, | |
| quantityBefore: { type: Number, required: true }, | |
| quantityChange: { type: Number, required: true }, // positive = add, negative = remove | |
| quantityAfter: { type: Number, required: true }, | |
| note: { type: String }, | |
| performedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, | |
| orderId: { type: mongoose.Schema.Types.ObjectId, ref: 'Order' }, | |
| barcodeScanned: { type: Boolean, default: false }, | |
| }, { timestamps: true }); | |
| inventoryLogSchema.index({ product: 1, createdAt: -1 }); | |
| inventoryLogSchema.index({ performedBy: 1 }); | |
| export default mongoose.model('InventoryLog', inventoryLogSchema); | |