Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
9cb2f58f
Commit
9cb2f58f
authored
Jan 11, 2021
by
박상호
🎼
Browse files
Merge remote-tracking branch 'origin/jiwon' into who
parents
b4f920ff
78f4f056
Changes
23
Show whitespace changes
Inline
Side-by-side
server/routes/product.routes.js
View file @
9cb2f58f
...
...
@@ -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
)
{
...
...
server/schemas/Cart.js
0 → 100644
View file @
9cb2f58f
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
server/schemas/Product.js
View file @
9cb2f58f
...
...
@@ -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
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment