File size: 533 Bytes
c0fb352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;