Commit 35b6c873 authored by 박상호's avatar 박상호 🎼
Browse files

Merge remote-tracking branch 'origin/ourMaster' into sangho

parents c19311c5 4323bde1
......@@ -46,10 +46,6 @@ function App() {
<PrivateRoute path="/account">
<Account />
</PrivateRoute>
{/* <PrivateRoute path='/kakao'>
</PrivateRoute>
<Route component={() => { window.location.href = 'https://compmath.korea.ac.kr'; return null; }} /> */}
<Redirect path="/" to="/" />
</Switch>
</Router>
......
......@@ -39,22 +39,22 @@ function ListCard(props) {
{e.products[0].productId.pro_name}
</Card.Header>)}
<Card.Text>
<Col className='justify-content-center'>
<Row className='justify-content-center' >
<>
<Col sm={3} xs={5} className='p-1'><li>주문번호 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e._id}</strong></Col>
</>
<Col sm={3} xs={5} className='p-1'><li>결제금액 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e.total}</strong></Col>
<Col className='justify-content-center'>
<Row className='justify-content-center' >
<>
<Col sm={3} xs={5} className='p-1'><li>주문번호 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e._id}</strong></Col>
</>
<Col sm={3} xs={5} className='p-1'><li>결제금액 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e.total}</strong></Col>
<Col sm={3} xs={5} className='p-1'><li>배송지 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong> {e.receiverInfo.address}</strong> <br />( {e.receiverInfo.address2} )</Col>
<Col sm={3} xs={5} className='p-1'><li>배송지 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong> {e.receiverInfo.address}</strong> <br />( {e.receiverInfo.address2} )</Col>
<Col sm={3} xs={5} className='p-1'><li>주문날짜 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e.createdAt.substring(0, 10)}</strong></Col>
</Row>
</Col>
<Col sm={3} xs={5} className='p-1'><li>주문날짜 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e.createdAt.substring(0, 10)}</strong></Col>
</Row>
</Col>
</Card.Text>
</Card.Body>
)
......
import { Pagination } from "react-bootstrap";
import React from 'react';
import { Pagination } from "react-bootstrap";
function Paginations({ index, totalPages, handlePage }) {
......@@ -33,21 +33,21 @@ function Paginations({ index, totalPages, handlePage }) {
`}
</style>
<Pagination.First onClick={() => handlePage(1)} />
{index === 1 ? <Pagination.Prev disabled /> : <Pagination.Prev onClick={()=>handlePage(index - 1)} />}
{index === totalPages && index > 4 ? <Pagination.Item onClick={()=>handlePage(index - 4)}>{index - 4}</Pagination.Item> : ""}
{index > 3 && index >= totalPages-1 ? <Pagination.Item onClick={()=>handlePage(index - 3)}>{index - 3}</Pagination.Item> : ""}
{index < 3 ? "" : <Pagination.Item onClick={()=>handlePage(index - 2)}>{index - 2}</Pagination.Item>}
{index === 1 ? "" : <Pagination.Item onClick={()=>handlePage(index - 1)}>{index - 1}</Pagination.Item>}
{index === 1 ? <Pagination.Prev disabled /> : <Pagination.Prev onClick={() => handlePage(index - 1)} />}
{index === totalPages && index > 4 ? <Pagination.Item onClick={() => handlePage(index - 4)}>{index - 4}</Pagination.Item> : ""}
{index > 3 && index >= totalPages - 1 ? <Pagination.Item onClick={() => handlePage(index - 3)}>{index - 3}</Pagination.Item> : ""}
{index < 3 ? "" : <Pagination.Item onClick={() => handlePage(index - 2)}>{index - 2}</Pagination.Item>}
{index === 1 ? "" : <Pagination.Item onClick={() => handlePage(index - 1)}>{index - 1}</Pagination.Item>}
<Pagination.Item active>{index}</Pagination.Item>
{index === totalPages ? "" : <Pagination.Item onClick={()=>handlePage(index + 1)}>{index + 1}</Pagination.Item>}
{index > totalPages-2 ? "" : <Pagination.Item onClick={()=>handlePage(index + 2)}>{index + 2}</Pagination.Item>}
{index <= totalPages-3 && index < 3 ? <Pagination.Item onClick={()=>handlePage(index + 3)}>{index + 3}</Pagination.Item> : ""}
{index <= totalPages-4 && index < 2 ? <Pagination.Item onClick={()=>handlePage(index + 4)}>{index + 4}</Pagination.Item> : ""}
{index === totalPages ? <Pagination.Next disabled /> : <Pagination.Next onClick={()=>handlePage(index + 1)} />}
{index === totalPages ? "" : <Pagination.Item onClick={() => handlePage(index + 1)}>{index + 1}</Pagination.Item>}
{index > totalPages - 2 ? "" : <Pagination.Item onClick={() => handlePage(index + 2)}>{index + 2}</Pagination.Item>}
{index <= totalPages - 3 && index < 3 ? <Pagination.Item onClick={() => handlePage(index + 3)}>{index + 3}</Pagination.Item> : ""}
{index <= totalPages - 4 && index < 2 ? <Pagination.Item onClick={() => handlePage(index + 4)}>{index + 4}</Pagination.Item> : ""}
{index === totalPages ? <Pagination.Next disabled /> : <Pagination.Next onClick={() => handlePage(index + 1)} />}
<Pagination.Last onClick={() =>handlePage(totalPages)} />
<Pagination.Last onClick={() => handlePage(totalPages)} />
</Pagination>
)
}
......
import React, { useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
import { Navbar, Nav } from 'react-bootstrap';
import axios from 'axios';
import catchErrors from '../utils/catchErrors';
import { Navbar, Nav } from 'react-bootstrap';
function SubNav() {
const [categoriesDiv, setCategoriesDiv] = useState([])
......
......@@ -188,7 +188,7 @@ function Account() {
<div className='m-2 mb-5'>
<ListCard ordered={ordered} status={'order'} />
</div>
</Container >
</Container>
)
}
......
......@@ -20,8 +20,10 @@ function Admin() {
useEffect(() => {
if (search.word == '') {
window.scrollTo(0,0)
getProductlist()
} else {
window.scrollTo(0,0)
handleSearch()
}
}, [currentPage])
......@@ -46,7 +48,7 @@ function Admin() {
setLength(response.data.length)
} catch (error) {
catchError(error, setError)
}
}
}
function handleChange(event) {
......
import React, { useState } from 'react';
import { Link, Redirect } from 'react-router-dom';
import axios from 'axios';
import catchErrors from '../utils/catchErrors';
import { handleLogin } from '../utils/auth';
import { Form, Col, Container, Button, Row, Alert } from 'react-bootstrap';
import axios from 'axios'
import catchErrors from '../utils/catchErrors'
import { handleLogin } from '../utils/auth'
const INIT_USER = {
id: '',
password: ''
}
function Login() {
const [validated, setValidated] = useState(false);
const [user, setUser] = useState(INIT_USER)
......@@ -95,7 +95,6 @@ function Login() {
</Row>
</Container>
)
}
export default Login
\ No newline at end of file
......@@ -36,10 +36,13 @@ function Payment({ match, location }) {
}, [cart])
async function getUser() {
const name = localStorage.getItem('name')
const tel = localStorage.getItem('tel')
const email = localStorage.getItem('email')
setUserData({ name: name, tel: tel, email: email })
try {
const response = await axios.get(`/api/users/account/${user}`)
const { name, tel, email } = response.data
setUserData({ name: name, tel: tel, email: email })
} catch (error) {
catchErrors(error, setError)
}
}
async function getCart() {
......@@ -107,11 +110,9 @@ function Payment({ match, location }) {
}
setAddress({ full: fullAddress, code: data.zonecode });
setOrder({ ...order, receiverInfo: { ...order.receiverInfo, address: fullAddress, postalCode: data.zonecode } })
console.log(fullAddress);
}
const postCodeStyle = {
// display: "block",
position: "absolute",
width: "400px",
height: "500px",
......@@ -159,11 +160,9 @@ function Payment({ match, location }) {
<p>주문하기를 눌러 결제를 이어가주세요.</p>
</div>
)
// setRedirect(data.redirect_url)
}
async function paymentCompleted() {
console.log(order)
const cartIds = []
order.products.map((el) => {
cartIds.push(el._id)
......@@ -209,13 +208,9 @@ function Payment({ match, location }) {
cancel_url: 'http://localhost:3000/shoppingcart',
})
})
console.log(response.data)
const data = await response.json()
window.location.href = data.redirect_url
} else {
console.log(response.data)
console.log(response2.data)
console.log(response3.data)
alert("주문이 완료되었습니다.")
history.push('/paymentcompleted')
}
......
......@@ -44,18 +44,18 @@ function PaymentCompleted() {
<h3 className="text-center font-weight-bold my-3">주문내역</h3>
<h5 className="font-weight-bold py-3 border-top border-bottom text-center" style={{ background: '#F7F3F3' }}>받는사람 정보</h5>
<div className="m-3">
<Row>
<Col xs={4} className="text-right">이름</Col>
<Col>{receiverInfo.name}</Col>
</Row>
<Row>
<Col xs={4} className="text-right">전화번호</Col>
<Col>{receiverInfo.tel}</Col>
</Row>
<Row>
<Col xs={4} className="text-right">주소</Col>
<Col>{receiverInfo.address}{receiverInfo.address2}</Col>
</Row>
<Row>
<Col xs={4} className="text-right">이름</Col>
<Col>{receiverInfo.name}</Col>
</Row>
<Row>
<Col xs={4} className="text-right">전화번호</Col>
<Col>{receiverInfo.tel}</Col>
</Row>
<Row>
<Col xs={4} className="text-right">주소</Col>
<Col>{receiverInfo.address}{receiverInfo.address2}</Col>
</Row>
</div>
<h5 className="font-weight-bold py-3 border-top border-bottom text-center" style={{ background: '#F7F3F3' }}>주문 상품 정보</h5>
{order.map((e) => (
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Redirect, Link, useHistory } from 'react-router-dom';
import ListCard from "../Components/ListCard";
import axios from 'axios';
......@@ -6,7 +6,7 @@ import catchErrors from '../utils/catchErrors';
import { Row, Col, Form, Card, Button, Modal, Image } from 'react-bootstrap';
function Product({ match, location }) {
function Product({ location }) {
const [product, setProduct] = useState(location.state)
const [productList, setProductList] = useState([])
const [color, setColor] = useState("")
......@@ -18,8 +18,8 @@ function Product({ match, location }) {
const [price, setPrice] = useState(0)
const [show, setShow] = useState(false);
let history = useHistory();
const boxRef = useRef(null);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
useEffect(() => {
getRecommend()
......@@ -39,14 +39,16 @@ function Product({ match, location }) {
try {
const response = await axios.get(`/api/order/recommend?products=${product.id}`)
setProductList(response.data)
if (response.data.length == 0) {
boxRef.current.style.display = "none"
}
} catch (error) {
catchErrors(error, setError)
}
}
function handleClick(e) {
const box = e.target.parentNode.parentNode
box.style.display = "none"
function handleClick() {
boxRef.current.style.display = "none"
}
function pushOptions() {
......@@ -113,20 +115,17 @@ function Product({ match, location }) {
}
async function addCart(event) {
console.log(cart)
if (cart.length < 1) {
alert("옵션을 선택해주세요")
}
else if (localStorage.getItem('id')) {
if (event.target.name === "shoppingcart") {
// preCart(color, size, count), productId(productlist에서 props), userId(로컬) 를 보내줌
try {
setError('')
const response = await axios.put('/api/cart/addcart', {
userId: localStorage.getItem('id'),
products: cart
})
console.log(response.data)
setShow(true)
} catch (error) {
catchErrors(error, setError)
......@@ -146,7 +145,6 @@ function Product({ match, location }) {
catchErrors(error, setError)
}
}
} else {
alert("로그인을 해주세요.")
return <Redirect to='/login' />
......@@ -271,10 +269,10 @@ function Product({ match, location }) {
</Col>
</Col>
</Row>
<Row className="justify-content-center mx-0 pt-3 px-2" style={{ position: "fixed", bottom: "0", width: "100%", backgroundColor: "#fff" }}>
<Row ref={boxRef} className="justify-content-center mx-0 pt-3 px-2" style={{ position: "fixed", bottom: "0", width: "100%", backgroundColor: "#fff" }}>
<Col sm={12} md={8}>
<h6 style={{ borderBottom: "1px solid", paddingBottom: "5px", marginBottom: "1em" }}>회원님이 선호할만한 상품 추천
<a className="close float-right" onClick={(e) => handleClick(e)} style={{ fontSize: "1rem", cursor: "pointer" }}>X</a>
<a className="close float-right" onClick={handleClick} style={{ fontSize: "1rem", cursor: "pointer" }}>X</a>
</h6>
<Row className="justify-content-lg-center mx-auto" style={{ flexWrap: "nowrap", width: "100%", overflowX: "auto" }}>
{productList.map(pro => (
......
import React, { useState, useEffect, useRef } from 'react';
import { Redirect } from 'react-router-dom';
import { Row, Col, Button, Form, Container, Alert, Spinner } from 'react-bootstrap';
import axios from 'axios';
import catchErrors from '../utils/catchErrors';
import { Row, Col, Button, Form, Container, Alert, Spinner } from 'react-bootstrap';
function ProductsRegist() {
const INIT_PRODUCT = {
......@@ -17,13 +17,10 @@ function ProductsRegist() {
main_image: [],
detail_image: []
}
const [preColors, setPreColors] = useState([])
const [categories, setCategories] = useState({ 0: [], 1: [[]] })
const [product, setProduct] = useState(INIT_PRODUCT)
const [categoryNum, setCategoryNum] = useState('')
const [tag, setTag] = useState(0)
const [subCate, setSubCate] = useState([])
const [cateList, setCateList] = useState([])
const [color, setColor] = useState({})
const [error, setError] = useState('')
const [success, setSuccess] = useState(false)
......@@ -68,7 +65,7 @@ function ProductsRegist() {
function addColor() {
colorRef.current.value = ''
setProduct({ ...product, "colors":[...product.colors, color["colors"]] })
setProduct({ ...product, "colors": [...product.colors, color["colors"]] })
}
function deleteColor(e) {
......@@ -169,7 +166,7 @@ function ProductsRegist() {
</Row>
{product.sub_category.map((el) => (
<div className="my-2">
<p name={el} className="mb-0" style={{ display: 'inline-block'}} >{product["main_category"]} / {el} </p>
<p name={el} className="mb-0" style={{ display: 'inline-block' }} >{product["main_category"]} / {el} </p>
<Button name={el} type="button" className="float-right p-0 btn-light" style={{ display: 'inline-block' }} onClick={deleteCategory} >
<img className="align-top" name={el} alt="삭제" src="https://img.icons8.com/fluent-systems-regular/24/000000/close-window.png" />
</Button>
......@@ -216,9 +213,9 @@ function ProductsRegist() {
</Row>
{product.colors.map((el) => (
<div className="my-2">
<p className="mb-0" style={{ display: 'inline-block' }}>{el}</p>
<p className="mb-0" style={{ display: 'inline-block' }}>{el}</p>
<Button style={{ display: 'inline-block' }} name={el} type="button" className="float-right p-0 btn-light" onClick={deleteColor}>
<img className="align-top" name={el} alt="삭제" src="https://img.icons8.com/fluent-systems-regular/24/000000/close-window.png" />
<img className="align-top" name={el} alt="삭제" src="https://img.icons8.com/fluent-systems-regular/24/000000/close-window.png" />
</Button>
</div>
))}
......
......@@ -28,23 +28,15 @@ function ProductsList({ match }) {
setSortingDisplayName('신상품')
}, [match.params.main])
useEffect(() => {
getSubsCategories()
getProductlist()
}, [mainCategory])
// useEffect(() => {
// if (sortingName == '' && search.word == '' && selectSubCategory == '') {
// getProductlist()
// } else if (sortingName == '' && search.word == '') {
// changePageforSubname()
// } else if (selectSubCategory == '' && sortingName == '') {
// searchList()
// } else {
// changePageforSorting()
// }
// }, [currentPage])
useEffect(() => {
window.scrollTo(0,0)
changePage()
}, [currentPage])
async function getSubsCategories() {
try {
......@@ -58,9 +50,10 @@ function ProductsList({ match }) {
async function getProductlist() {
try {
console.log("getProductlist 실행")
setError('')
setSelectSubCategory('')
setSortingName('')
setSortingDisplayName('신상품')
setSearch({ word: '' })
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?page=${currentPage}`)
setProductlist(response.data.productsPiece)
......@@ -70,17 +63,6 @@ function ProductsList({ match }) {
}
}
async function searchList() {
try {
console.log("seacrchList 실행")
setError('')
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} catch (error) {
catchError(error, setError)
}
}
function handleChange(event) {
setSearch({ word: event.target.value })
}
......@@ -88,9 +70,10 @@ function ProductsList({ match }) {
async function handleSearch(e) {
e.preventDefault()
try {
console.log("handleSearch 실행")
setError('')
setSelectSubCategory('')
setSortingName('')
setSortingDisplayName('신상품')
setCurrentPage(1)
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&page=1`)
setProductlist(response.data.productsPiece)
......@@ -102,50 +85,22 @@ function ProductsList({ match }) {
}
}
// async function changePageforSorting() {
// try {
// console.log("changePageforSorting 실행")
// setError('')
// if (selectSubCategory != '') {
// const response = await axios.get(`/api/product/getproduct/sub?subname=${selectSubCategory}&method=${sortingName}&page=${currentPage}`)
// setProductlist(response.data.productsPiece)
// setLength(response.data.length)
// setSortingDisplayName()
// } else if (search.word != '') {
// const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&method=${sortingName}&page=${currentPage}`)
// setProductlist(response.data.productsPiece)
// } else {
// console.log("else")
// const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?method=${sortingName}&page=${currentPage}`)
// setProductlist(response.data.productsPiece)
// }
// } catch (error) {
// catchError(error, setError)
// }
// }
async function handleSort(method) {
try {
console.log("handleSort 실행")
setError('')
setCurrentPage(1)
setSortingName(method)
if (selectSubCategory != '') {
console.log("selectSubCategory != ''")
const response = await axios.get(`/api/product/getproduct/sub?subname=${selectSubCategory}&method=${method}&page=1`)
setProductlist(response.data.productsPiece)
setSortingDisplayName(response.data.str)
} else if (search.word != '') {
console.log("search.word != ''")
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&method=${method}&page=1`)
setProductlist(response.data.productsPiece)
// setLength(response.data.length)
setSortingDisplayName(response.data.str)
} else {
console.log("else")
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?method=${method}&page=1`)
setProductlist(response.data.productsPiece)
// setLength(response.data.length)
setSortingDisplayName(response.data.str)
}
} catch (error) {
......@@ -153,19 +108,7 @@ function ProductsList({ match }) {
}
}
async function changePageforSubname() {
try {
console.log("changePageforSubname 실행")
setError('')
const response = await axios.get(`/api/product/getproduct/sub?subname=${selectSubCategory}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} catch (error) {
catchError(error, setError)
}
}
async function handleSubname(e) {
console.log("handleSubname 실행")
const subname = e.target.name
setSelectSubCategory(e.target.name)
try {
......@@ -182,6 +125,32 @@ function ProductsList({ match }) {
}
}
async function changePage() {
try {
setError('')
if (selectSubCategory == '' && sortingName == '' && search.word == '') {
getProductlist()
} else if (selectSubCategory == '' && sortingName == '') {
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} else if (search.word == '' && sortingName == '') {
const response = await axios.get(`/api/product/getproduct/sub?subname=${selectSubCategory}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} else if (search.word == '' && selectSubCategory == '') {
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?method=${sortingName}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} else if (selectSubCategory == '') {
const response = await axios.get(`/api/product/getproduct/main/${mainCategory}?product=${search.word}&method=${sortingName}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
} else if (search.word == '') {
const response = await axios.get(`/api/product/getproduct/sub?subname=${selectSubCategory}&method=${sortingName}&page=${currentPage}`)
setProductlist(response.data.productsPiece)
}
} catch (error) {
catchError(error, setError)
}
}
if (error) {
alert(`${error}`)
setError('')
......@@ -190,7 +159,6 @@ function ProductsList({ match }) {
return (
<Container>
{console.log("subCategory=",selectSubCategory,"sortingName=",sortingName,"search=",search.word,"page=",currentPage)}
<style type="text/css">
{`
@font-face {
......
......@@ -86,7 +86,7 @@ function Signup() {
<Form.Group as={Row} controlId="formBasicNumber">
<Form.Label column sm="4" for='number'>
주민등록번호 </Form.Label>
<Row style={{ width: '300px'}} className='px-3'>
<Row style={{ width: '300px' }} className='px-3'>
<Col sm="6" xs='5' className='pr-1'>
<Form.Control
className='pl-2 pr-0'
......
......@@ -6,7 +6,7 @@ import App from './App';
ReactDOM.render(
<React.StrictMode>
<App/>
<App />
</React.StrictMode>,
document.getElementById('root')
);
......
import axios from "axios";
export function handleLogin({ userId, role, name, tel, email }) {
export function handleLogin({ userId, role }) {
localStorage.setItem('id', userId)
localStorage.setItem('role', role)
localStorage.setItem('name', name)
localStorage.setItem('tel', tel)
localStorage.setItem('email', email)
}
export async function handleLogout() {
......
......@@ -43,8 +43,7 @@
"sub_category": [
"PATTERN DRESS",
"SHORT DRESS",
"BUSTIER DRESS",
""
"BUSTIER DRESS"
],
"detail_imgUrls": [
"1e1f031af5e0c444735024de7055e17a"
......@@ -2116,35 +2115,293 @@
"__v": 0
},{
"_id": {
"$oid": "60175b6cdda9b735ecad4d2e"
"$oid": "6017b4f1ea3dd53f9818549c"
},
"purchase": 0,
"sizes": [
"FREE"
],
"colors": [
"아이보리",
"블랙",
"회베이지"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"468a9ce6b27ad5c5fa0a93ddfb382377",
"085bb67d598ae074450509a7f963b59a",
"928d1bc6be21474f30888a811b426f7b"
],
"pro_name": "L-1148 더블자켓",
"price": 49800,
"stock": 300,
"main_category": "OUTER",
"description": "당신에 추억에 함께하는 클래식 웨어\n\n유행에 치우치지 않은 기본에 충실한 클래식한 무드를 담았습니다.\n세월이 지나도 변하지 않는 특별한 추억을 선사하는 프리미엄 럽",
"main_imgUrl": "00c9383d527823da3b1e607e1085519c",
"createdAt": {
"$date": "2021-02-01T07:59:45.569Z"
},
"updatedAt": {
"$date": "2021-02-01T07:59:45.569Z"
},
"__v": 0
},{
"_id": {
"$oid": "6017b654ea3dd53f9818549d"
},
"purchase": 0,
"sizes": [
"FREE"
],
"colors": [
"브라운"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"4e05910bf0fa5a42dc16a59b42247fcf",
"8781aa379544b56d0cc9e12342505d12",
"1cabca31e6abd35d52aaec45a3e5ae04",
"878d985bfeaa87b098f4ba35108f6653"
],
"pro_name": "포근포근 울체크자켓남방",
"price": 32800,
"stock": 500,
"main_category": "OUTER",
"description": "여유있는 품으로 사이즈 구애없이 편안하게 즐기기 좋으며 힙을 완전히 덮어주는 기장으로 자연스러운 체형 커버를 도와드립니다.\n와이드한 체크 패턴과 버튼 디테일로 캐주얼한 무드가 느껴지고 바스트 라인에는 리얼 포켓으로 실용적인 포인트를 더해주었어요.\n도툼한 두께의 모직, 울 함유 원단으로 높은 보온성을 자랑하는 데일리 아이템 - 셔츠는 물론 자켓으로도 활용가능하답니다.",
"main_imgUrl": "46542cf5fa8017ab5fe22bcbe48114f7",
"createdAt": {
"$date": "2021-02-01T08:05:40.743Z"
},
"updatedAt": {
"$date": "2021-02-01T08:05:40.743Z"
},
"__v": 0
},{
"_id": {
"$oid": "6017b95bea3dd53f9818549e"
},
"purchase": 0,
"sizes": [
"FREE"
],
"colors": [
"보카그레이(boca grey)",
"블랙(black)"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"67beee01b1648e765fd9f60b90cdf61e",
"5298a980894df0093ef6746f2b9f9c61",
"766b28622e5de31234a93d2285a109a4",
"c55f96232af2e0dba7d80a46ae023115"
],
"pro_name": "L-1165 울 라이더자켓",
"price": 59800,
"stock": 270,
"main_category": "OUTER",
"description": "울폴리 혼방으로 형태유지가 잘 되고 흡습성과 내구성이 좋으며 보온성이 좋은 프리미엄 럽 울 라이더자켓 입니다. 조직 자체의 밀도가 높아 탄탄한 형태감을 완성시켜드리며, 여유있는 루즈핏으로 사이즈 구애없이 편안하게 착용 가능합니다. 프론트 지퍼로 손쉬운 오픈클로징을 도와드립니다.",
"main_imgUrl": "a90a168e875f8d5d997e2e926d94afa1",
"createdAt": {
"$date": "2021-02-01T08:18:35.649Z"
},
"updatedAt": {
"$date": "2021-02-01T08:18:35.649Z"
},
"__v": 0
},{
"_id": {
"$oid": "6017ba48ea3dd53f9818549f"
},
"purchase": 0,
"sizes": [
"FREE"
],
"colors": [
"진청(dark denim)"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"1ad90f85c3e9a1e226b4aa4b37376f7f",
"d52e446a700ebbc110077f991726ec1d",
"2e67ffa0f3c5fbb54b301586e57a3e6d",
"f0c2f2de1082dc33972f2447f2a1954f",
"65da56fe5a2a5acb653fd45089dbf288"
],
"pro_name": "체인디 청자켓",
"price": 29800,
"stock": 300,
"main_category": "OUTER",
"description": "실용성은 물론, 스타일링적인 측면까지 고려한 뉴시즌 데님자켓 소개해드립니다. 흔히 볼 수 있는 벙벙한 루즈핏 자켓들과는 다르게 스타일리쉬한 느낌이 묻어나는 루즈핏 실루엣이 정말 멋스러운데요, 기본 티셔츠 위에 살짝 걸쳐주기만 해도 완벽한 스타일이 연출된답니다. :) 바스트라인에 포켓 디테일로 포인트가 되며, 양사이드 포켓으로 실용적인 부분까지 놓치지 않았어요. 밑단의 스트랩 비조와 화이트 스티치로 캐주얼한 포인트까지 - 입었을 때 더욱 돋보이는 핏을 연출해주는 아이템으로 정말 소장가치가 높답니다.",
"main_imgUrl": "80e4a7d512f62cadd3eadef1468ff847",
"createdAt": {
"$date": "2021-02-01T08:22:32.105Z"
},
"updatedAt": {
"$date": "2021-02-01T08:22:32.105Z"
},
"__v": 0
},{
"_id": {
"$oid": "6018b270ea3dd53f981854a0"
},
"purchase": 0,
"sizes": [
"XL",
"L",
"M"
],
"colors": [
"블랙",
"라벤더핑크",
"연노랑"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"6ec5480d0b16ce21606eb86b3ffa78b1",
"27a5810cf514d25c97b8a2ed9ac5cd3c",
"5f0a81a4fbac75ad2b646498287928fb",
"202f29dd88564f2cee1d495e7dd0c55b",
"e2db647be1b791e106d2155b53aba363"
],
"pro_name": "L-902 세미오버핏 싱글자켓",
"price": 49800,
"stock": 280,
"main_category": "OUTER",
"description": "화사한 컬러감이 매력적인 연노랑, 시크한 무드의 블랙, 페미닌하면서도 트렌디한 무드의 라벤더핑크 3컬러로 준비하였어요. 기본 테일러드 카라 네크라인으로 갸름한 페이스라인을 연출해드리며, 세미 오버핏으로 제작되어 약간 여유있게 맞는 느낌의 실루엣이 정말 매력적이였던 아이템 이예요. 어깨라인엔 패드가 들어가있어 흐트러짐 없이 핏을 잡아드리구요. 부드럽지만 탄탄한 소재감으로 구김없이 멋스럽게 즐길 수 있답니다. 양 사이드 플랩포켓 위에 들어간 핀턱 디테일로 시선을 모아 자칫 밋밋할수있었던 디자인에 포인트를 더해주었답니다. 데일리룩뿐만 아니라 격식룩, 모임룩, 오피스루 등 다양한 장소에서 활용 가능한 기본 아이템으로 소장가치 있으실거예요. 올 시즌 프리미엄 럽과 함께 더욱 사랑스러워지세요.",
"main_imgUrl": "00d98720b79be5a81030e711f231444e",
"createdAt": {
"$date": "2021-02-02T02:01:20.080Z"
},
"updatedAt": {
"$date": "2021-02-02T02:01:20.080Z"
},
"__v": 0
},{
"_id": {
"$oid": "6018bfdd742f94314063e43d"
},
"purchase": 0,
"sizes": [
"XL",
"L",
"M"
],
"colors": [
"블랙",
"블루그레이"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"7a6cd024395651aac6331816746a031d",
"ee78aa56da8a9001d0638aefe20f48e8",
"25a71f6b210a04698411dee2a0c85366",
"3ffbbe4717f068a80ec718bd627fa660",
"e38dd7ff3e02d1424c62f3ef45b70874",
"0761e9f7711278f51d674e16133777b9",
"faf475089a8b3fbe6704d42a63541e8b",
"6e311d6dfad500c3f4a4bc317bf4bae4"
],
"pro_name": "제스티 테일러드더블자켓",
"price": 29800,
"stock": 320,
"main_category": "OUTER",
"description": "모던 시크한 분위기를 물씬 풍기는 테일러드 더블자켓 입니다. 손끝에서 탄탄하게 느껴지는 조직감으로 가볍게 걸쳐주기만 해도 툭 떨어지는 멋스러운 핏이 완성되며, 소재의 변색과 변형이 적어 우수한 내구성을 지닌 자켓입니다. 깔끔한 테일러드 카라로 디자인되었으며, 어깨 패드가 내장되어 멋스럽게 즐겨보실 수 있답니다. 더블버튼으로 클래식한 매력을 담았으며, 힙라인을 가리는 기장감으로 부담없이 즐겨보실 수 있어요. 2가지 컬러로 준비된 자켓 - 데일리&격식룩으로 즐겨주세요.",
"main_imgUrl": "7dc0ce4023334a5de98059f793abdefd",
"createdAt": {
"$date": "2021-02-02T02:58:37.239Z"
},
"updatedAt": {
"$date": "2021-02-02T02:58:37.239Z"
},
"__v": 0
},{
"_id": {
"$oid": "6018cfc0742f94314063e43e"
},
"purchase": 0,
"sizes": [
"XL",
"L",
"M"
],
"colors": [
"블랙",
"연그레이"
],
"sub_category": [
"JACKET"
],
"detail_imgUrls": [
"8191c374f943f5536b5c23d5f8f430ed",
"8627d42c3306f599a7bd020ed9325625",
"288c6d96221323641df35c8d771268d5",
"b3203e35bce94e615eb1d229b15c3904",
"2c19ff744f2a812cbf288f8e8883bf7c",
"1fad244d02356a6a2a8167058046dacc",
"a8008b5933ebe65822fdb56e549f733c",
"3fb3e444517873ea0ac2aedf6794d238"
],
"pro_name": "L-1128 더블하프자켓",
"price": 49800,
"stock": 245,
"main_category": "OUTER",
"description": "편안한 실루엣 속 클래식한 감성, 매일 함께 하고 싶은 고유의 심플한 디자인 감성을 전달하는 프리미엄 럽. 데일리하게 매치 가능한 블랙,연그레이 2컬러 구성으로 준비 하였습니다. 전체적으로 넉넉한 루즈핏으로 체형을 완벽하게 가려주어 여리한 실루엣이 연출되며 플랩 포켓을 더하여 밋밋하을 덜어주고 실용성을 높였습니다. 더블 버튼으로 오픈 클로징하여 모던한 무드가 풍겨지며 데일리하게 스타일링 하기 좋은 자켓으로 추천드릴게요.",
"main_imgUrl": "0493979e719e243c45fe782bbd6ed890",
"createdAt": {
"$date": "2021-02-02T04:06:24.374Z"
},
"updatedAt": {
"$date": "2021-02-02T04:06:24.374Z"
},
"__v": 0
},{
"_id": {
"$oid": "6018d7c62c66633104c0dab4"
},
"purchase": 0,
"sizes": [
"225",
"230",
"235",
"240",
"245",
"250"
],
"colors": [
"블랙"
],
"sub_category": [
"LONG DRESS",
"PATTERN DRESS"
"BOOTS"
],
"detail_imgUrls": [
"74f9f128c9fc48dd04e86d3f56db6647",
"daa7042ede9999421e4a79e7435cd9ff"
"b527e4b8b9d3bb40555b4e68d9c5a3ed",
"6411303b2c96848b6a23e1e0c8539e8b",
"3249c2ea4dcbd75a3108a5f7e3415db7",
"5c99911d878908f349982cdf6ac7955e",
"22eae8f9d17dabb36c7f88d0f82a805b"
],
"pro_name": "페로츠 플라워뷔스티에롱원피스",
"price": 29000,
"stock": 100,
"main_category": "DRESS",
"description": "잔잔한 플라워 패턴으로 사랑스러운 분위기를 내어드리는 쿠샵 메이드 뷔스티에 롱원피스입니다. 슬리브리스 타입으로 다양한 이너와 레이어드하여 스타일링 가능하며, 어깨끈은 조절이 가능해 체형에 맞게 착용해 보실 수 있답니다. 롱한 기장감에 2단 프릴로 자연스럽게 플레어지게 떨어져 러블리하며, 하체군살 커버에 탁월합니다. 또한, 실키한 안감이 더해져 비침 걱정을 덜었답니다. 데일리하게 코디하기 좋은 아이보리, 블랙 2가지 컬러로 준비해두었어요 :)",
"main_imgUrl": "db14d03a23fdf5e91a613ad26f254030",
"pro_name": "바네사5cm 니하이롱부츠",
"price": 34800,
"stock": 243,
"main_category": "SHOES",
"description": "시크하면서도 페미닌한 무드를 풍겨주는 니하이롱부츠입니다. 스웨이드한 촉감과 쫀쫀한 신축성으로 간편하게 탈 착화가 가능해 편안한게 스타일링 가능하며 다리를 슬림하게 잡아주어 더 날씬하고 길어보이는 실루엣이 연출됩니다. 스퀘어 쉐입의 앞코라인으로 발가락을 편안하게 하며 절개라인을 더해 밋밋함을 덜었어요. 5cm의 과하지않은 굽높이로 키높이 효과까지 더해드린답니다.",
"main_imgUrl": "9b5afdc107e0a7a8958898ec8920914e",
"createdAt": {
"$date": "2021-02-01T01:37:48.251Z"
"$date": "2021-02-02T04:40:39.009Z"
},
"updatedAt": {
"$date": "2021-02-01T01:37:48.251Z"
"$date": "2021-02-02T04:40:39.009Z"
},
"__v": 0
}]
\ No newline at end of file
......@@ -36,5 +36,4 @@ app.use('/api/order', orderRouter)
app.listen(config.port, () => {
console.info('Server started on port %s.', config.port)
})
})
\ No newline at end of file
......@@ -7,5 +7,4 @@ const config = {
cookieMaxAge: 60 * 60 * 24 * 7 * 1000
}
export default config
\ No newline at end of file
export default config
\ No newline at end of file
......@@ -7,7 +7,6 @@ const login = async (req, res) => {
const { id, password } = req.body
try {
const user = await User.findOne({ id }).select('password role name tel email')
console.log('u=', user)
if (!user) {
return res.status(404).send(`${id}가 존재하지 않습니다.`)
}
......@@ -21,7 +20,7 @@ const login = async (req, res) => {
httpOnly: true,
secure: config.env === 'production'
})
res.json({ userId: user._id, role: user.role, name: user.name, tel: user.tel, email:user.email })
res.json({ userId: user._id, role: user.role })
} else {
res.status(401).send('비밀번호가 일치하지 않습니다.')
......@@ -37,5 +36,4 @@ const logout = (req, res) => {
res.send('로그아웃 되었습니다.')
}
export default { login, logout }
\ No newline at end of file
......@@ -17,38 +17,33 @@ const addCart = async (req, res) => {
const changeCart = async (req, res) => {
const { userId, products } = req.body
console.log(products)
try {
const cart = await Cart.findOne({ userId: userId })
console.log(cart)
await Cart.updateOne(
{ _id: cart._id },
{ $set: { products: products } }
)
res.send("카트에 체크가 활성화되었습니다")
} catch (error) {
console.log(error)
res.send("카트 체인지 실패")
}
}
const showCart = async (req, res) => {
try {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
const cart = await Cart.findOne({ userId: req.id }).populate({
path: 'products.productId',
model: 'Product'
})
res.status(200).json(cart.products)
console.log("cart-products : ", cart);
} catch (error) {
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
console.log(error)
res.status(500).send('쇼핑카트를 불러오지 못했습니다.')
}
}
const deleteCart = async (req, res) => {
console.log(req.body)
const { userId, cartId } = req.body
try {
const cart = await Cart.findOneAndUpdate(
......@@ -63,14 +58,13 @@ const deleteCart = async (req, res) => {
} catch (error) {
console.log(error)
res.status(500).send('해당 카트를 삭제하지 못했습니다.')
}
}
const deleteCart2 = async (req, res) => {
console.log(req.body)
const { userId, cartId } = req.body
try {
for( let i = 0; i < cartId.length; i++ ){
for (let i = 0; i < cartId.length; i++) {
await Cart.findOneAndUpdate(
{ userId: userId },
{ $pull: { products: { _id: cartId[i] } } },
......@@ -81,11 +75,9 @@ const deleteCart2 = async (req, res) => {
})
}
res.send("주문완료 및 쇼핑카트에서 삭제")
// res.json(cart)
} catch (error) {
console.log(error)
res.status(500).send('해당 카트를 삭제하지 못했습니다.')
}
}
......@@ -103,5 +95,4 @@ const userById = async (req, res, next, id) => {
}
}
export default { addCart, changeCart, showCart, deleteCart,deleteCart2, userById }
\ No newline at end of file
export default { addCart, changeCart, showCart, deleteCart, deleteCart2, userById }
\ No newline at end of file
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