ADD: SignedUrls for documents, mainImage and images
ADD: Bucket and Upload System ADD: New errors ADD: Virtuals for categories ADD: Features system ADD: File management system
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
const mongoose = require('mongoose')
|
||||
const ObjectID = mongoose.Schema.Types.ObjectId
|
||||
|
||||
const featureSchema = new mongoose.Schema({
|
||||
nativeName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
englishName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
category: {
|
||||
type: ObjectID,
|
||||
ref: 'Category',
|
||||
required: true,
|
||||
},
|
||||
predefinedValues: [String],
|
||||
unit: String,
|
||||
isFilterable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
featureType: {
|
||||
type: String,
|
||||
enum: ['string', 'boolean', 'number', 'date'],
|
||||
default: 'string',
|
||||
},
|
||||
filterType: {
|
||||
type: String,
|
||||
enum: ['exact', 'range', 'multi', 'bool'],
|
||||
default: 'exact',
|
||||
},
|
||||
tag: String,
|
||||
priority: Number,
|
||||
}, {
|
||||
toJSON: { virtuals: true },
|
||||
toObject: { virtuals: true },
|
||||
timestamps: true,
|
||||
})
|
||||
|
||||
featureSchema.index({ englishName: 1, category: 1 }, { unique: true })
|
||||
|
||||
const Feature = mongoose.model('Feature', featureSchema)
|
||||
|
||||
module.exports = Feature
|
||||
Reference in New Issue
Block a user