Untitled
unknown
plain_text
a year ago
1.7 kB
9
Indexable
const mongoose = require('mongoose');
const productSchema = new mongoose.Schema({
sku: {
type: String,
unique: true,
required: true
},
quantity: {
type: Number,
min: 0, required: true
},
name: {
type: Map,
of: String,
required: true
},
description: {
type: Map,
of: String, required: true
},
images:
[{
type: mongoose.Schema.Types.ObjectId,
ref: 'Image'
}],
offer:
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Offer'
},
categories:
[{
type: mongoose.Schema.Types.ObjectId,
ref: 'Category'
}],
subcategories:
[{
type: mongoose.Schema.Types.ObjectId,
ref: 'SubCategory'
}],
groups:
[{ type: mongoose.Schema.Types.ObjectId, ref: 'Group' }],
brand:
{ type: mongoose.Schema.Types.ObjectId, ref: 'Brand' },
tags:
[String],
pricing: {
initialPrice: {
type: Number,
min: 0, required: true
},
listPrice: {
type: Number, min: 0,
required: true
},
publicPrice: {
type: Number,
min: 0, required: true
},
discountPrices: [{
type: Number,
min: 0
}]
},
visibility: {
type: Boolean,
required: true
},
// stockStatus: { type: Boolean, default: true }
});
const Product = mongoose.model('Product', productSchema);
module.exports = Product;
Editor is loading...
Leave a Comment