Spaces:
Sleeping
Sleeping
| import mongoose from 'mongoose'; | |
| const subcategorySchema = new mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: [true, 'Subcategory name is required'], | |
| trim: true | |
| }, | |
| parentCategory: { | |
| type: String, | |
| required: true, | |
| enum: ['Women', 'Men'] // Links it strictly to your main edits | |
| }, | |
| image: { | |
| type: String, // Cloudinary URL for the visual bubble | |
| required: true | |
| } | |
| }, { | |
| timestamps: true | |
| }); | |
| const Subcategory = mongoose.model('Subcategory', subcategorySchema); | |
| export default Subcategory; | |