#2, добавила модель товара

parent de45077d
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ProductSchema = new Schema({
author: {
type: Schema.Types.ObjectId,
ref: 'User',
required: true
},
category: {
type: Schema.Types.ObjectId,
ref: 'Category',
required: true
},
title: {
type: String,
required: true
},
description: {
required: true,
type: String
},
image: {
required: true,
type: String
},
price: {
required: true,
type: Number
}
});
const Product = mongoose.model("Product", ProductChema);
module.exports = Product;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment