Spaces:
Configuration error
Configuration error
Download src/models/Product.js from sdsdsd55415/pcstore: direct link, hf CLI and curl.
- Browser
- Download file 934 Bytes
-
https://huggingface.co/spaces/sdsdsd55415/pcstore/resolve/main/src/models/Product.js
- Command line
-
hf download hf://spaces/sdsdsd55415/pcstore/src/models/Product.js
-
curl -L -o Product.js https://huggingface.co/spaces/sdsdsd55415/pcstore/resolve/main/src/models/Product.js
934 Bytes
| const mongoose = require('mongoose'); | |
| const productSchema = new mongoose.Schema({ | |
| id: { type: Number, required: true, unique: true }, | |
| name: { type: String, required: true }, | |
| price: Number, | |
| originalPrice: { type: Number, default: null }, // For Flash Sales | |
| discountPercent: { type: Number, default: 0 }, // Discount % | |
| quantity: { type: Number, default: 0 }, | |
| condition: { type: String, enum: ['new', 'used'], default: 'new' }, | |
| description: String, | |
| category: String, // Category ID | |
| media: [{ | |
| type: { type: String }, // 'photo' or 'video' | |
| file_id: String | |
| }], | |
| reviews: [{ | |
| userId: String, | |
| userName: String, | |
| rating: Number, // 1-5 | |
| comment: String, | |
| date: { type: Date, default: Date.now } | |
| }], | |
| createdAt: { type: Date, default: Date.now } | |
| }); | |
| module.exports = mongoose.model('Product', productSchema); | |