Commit 9cb2f58f authored by 박상호's avatar 박상호 🎼
Browse files

Merge remote-tracking branch 'origin/jiwon' into who

parents b4f920ff 78f4f056
......@@ -2,11 +2,22 @@ import express from "express";
import path from 'path';
import multer from 'multer';
import productCtrl from '../controllers/product.controller.js';
import fs from 'fs'
// process.cwd() + '/client/public/image'
const router = express.Router()
fs.readdir('uploads', (error, data) => {
if (error) {
fs.mkdirSync('uploads');
if (data == undefined) {
fs.mkdirSync('/main')
fs.mkdirSync('/detail')
}
} else console.log("else data",data)
})
const upload = multer({
storage: multer.diskStorage({
destination(req, file, cb) {
......
import mongoose from 'mongoose'
const { String, Number, Array, ObjectId } = mongoose.Schema.Types
const productschema = new mongoose.Schema ({
pro_name: {
type: String,
required: true
},
price:{
type: Number,
required: true
},
main_image: {
type: String,
required: true
},
color:{
type: String,
required: true
},
size:{
type: String,
required: true
},
productObjectId: {
type: ObjectId,
required: true
}
})
const CartSchema = new mongoose.Schema({
userId: {
type: String,
// required: true
},
products : {
type: [productschema],
required: true
}
}, {
timestamps: true
})
export default mongoose.models.Cart || mongoose.model('Cart', CartSchema)
\ No newline at end of file
......@@ -20,6 +20,14 @@ const ProductSchema = new mongoose.Schema({
required: true,
default: 0
},
size: {
type: Array,
required: true
},
color: {
type: Array,
required: true
},
main_category: {
type: String,
required: true,
......
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