Commit 722835e1 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

Merge branch 'jiwon'

parents 87029678 8c09598d
...@@ -3,37 +3,45 @@ import styles from './seatTable.module.scss' ...@@ -3,37 +3,45 @@ import styles from './seatTable.module.scss'
const SeatTable = (props) => { const SeatTable = (props) => {
const table = [] const table = []
for (let rowIndex = 0; rowIndex < props.allSeat.row; rowIndex++) { if (props.theaterInfo) {
table.push(<span className="me-3" style={{color:"gray"}}>{String.fromCharCode(rowIndex + 65)}</span>) for (let rowIndex = 0; rowIndex < props.theaterInfo.rows; rowIndex++) {
// console.log(String.fromCharCode(rowIndex+65)) table.push(<span className="me-3" style={{ color: "gray" }}>{String.fromCharCode(rowIndex + 65)}</span>)
for (let colIndex = 0; colIndex < props.allSeat.col; colIndex++) { for (let colIndex = 0; colIndex < props.theaterInfo.columns; colIndex++) {
table.push( table.push(
<span> <span>
<button className={props.selectedSeats.find(el => el === String.fromCharCode(rowIndex + 65) + String(colIndex + 1)) ? styles.on : styles.btn} name={`${String.fromCharCode(rowIndex + 65)}${colIndex + 1}`} type="button" onClick={handleClick}> {colIndex + 1} </button> {props.reservedSeats.find(el => el === String(rowIndex + 1) + '-' + String(colIndex + 1))
?
<button className={styles.btnBlock} name={rowIndex + 1} id={colIndex + 1} type="button" disabled>{colIndex + 1}</button>
:
<button className={props.selectedSeats.find(el => el === String(rowIndex + 1) + '-' + String(colIndex + 1)) ? styles.on : styles.btn} name={rowIndex + 1} id={colIndex + 1} type="button" onClick={handleClick}> {colIndex + 1} </button>
}
</span> </span>
) )
} }
table.push(<br />) table.push(<br />)
} }
}
function handleClick(event) { function handleClick(event) {
const num = Object.values(props.count).reduce((a, b) => (a + b)) const num = Object.values(props.count).reduce((a, b) => (a + b))
if (props.selectedSeats.find(el => el === event.target.name)) { if (props.selectedSeats.find(el => el === event.target.name + '-' + event.target.id)) {
//제거 //제거
const deleted = props.selectedSeats.filter((element) => element !== event.target.name); const deleted = props.selectedSeats.filter((element) => element !== event.target.name + '-' + event.target.id);
props.setSelectedSeats(deleted) props.setSelectedSeats(deleted)
} else { } else {
if (props.selectedSeats.length > num - 1) { if (props.selectedSeats.length > num - 1) {
alert("선택한 좌석이 예매인원보다 많습니다.") alert("선택한 좌석이 예매인원보다 많습니다.")
} else { } else {
//추가 //추가
props.setSelectedSeats([...props.selectedSeats, event.target.name]) props.setSelectedSeats([...props.selectedSeats, event.target.name + '-' + event.target.id])
} }
} }
} }
return ( return (
<div className="text-center"> <div className="text-center">
{/* {console.log(props.theaterInfo)} */}
{console.log(props.selectedSeats)} {console.log(props.selectedSeats)}
<div className="mb-2" style={{ backgroundColor: "gray" }}>Screen</div> <div className="mb-2" style={{ backgroundColor: "gray" }}>Screen</div>
{table} {table}
......
...@@ -13,3 +13,9 @@ ...@@ -13,3 +13,9 @@
background: red ; background: red ;
color:white color:white
} }
.btnBlock {
background: gray;
border: 0;
color:white;
}
\ No newline at end of file
...@@ -4,17 +4,13 @@ const TicketingTheater = (props) => { ...@@ -4,17 +4,13 @@ const TicketingTheater = (props) => {
function handleClick(event) { function handleClick(event) {
// event.preventDefault() // event.preventDefault()
console.log(event.target.name) console.log(event.target.name)
props.setTicketInfo({ ...props.ticketInfo, theater:event.target.name}) props.setTicketInfo({ ...props.ticketInfo, cinema: event.target.name })
} }
return ( return (
<div > <div >
<div className="d-grid gap-2"> <div className="d-grid gap-2">
{props.theaterInfo.theater.length > 0 <button name={props.cinemaInfo.cinemaName} className={`${props.ticketInfo.cinema === props.cinemaInfo.cinemaName ? styles.on : styles.btn}`} onClick={handleClick}>{props.cinemaInfo.cinemaName}</button>
? props.theaterInfo.theater.map(name => (
<button name={name} className={`${props.ticketInfo.theater === name ? styles.on : styles.btn}`} onClick={handleClick}>{name}</button>
))
: <div>영화관 정보가 존재하지 않습니다.</div>}
</div> </div>
</div> </div>
) )
......
import axios from 'axios' import axios from 'axios'
import { useState } from 'react' import { useEffect, useState } from 'react'
import Kakaopay from '../components/Kakaopay' import Kakaopay from '../components/Kakaopay'
import { useAuth } from '../context/auth_context'
import catchErrors from '../utils/catchErrors'
const Payment = ({ location }) => { const Payment = ({ location }) => {
const [ticketInfo, setTicketInfo] = useState({ ...location.state }) const [ticketInfo, setTicketInfo] = useState({ ...location.state })
const [error, setError] = useState("")
const [userInfo, setUserInfo] = useState()
const { user } = useAuth()
useEffect(() => {
getUserInfo()
}, [])
async function getUserInfo() {
try {
const response = await axios.post(`/api/auth/getuserinfo`, {
id: user.id
})
setUserInfo(response.data)
} catch (error) {
catchErrors(error, setError)
}
}
async function SendMail(e) { async function SendMail(e) {
try { try {
const response = await axios.post('/api/email/send',{ const response = await axios.post('/api/email/send', {
email:e.target.name ...ticketInfo,
...userInfo
}) })
console.log(response.data) console.log(response.data)
} catch (error) { } catch (error) {
...@@ -19,6 +42,7 @@ const Payment = ({ location }) => { ...@@ -19,6 +42,7 @@ const Payment = ({ location }) => {
return ( return (
<div className="container" style={{ color: "white" }}> <div className="container" style={{ color: "white" }}>
{console.log(ticketInfo)} {console.log(ticketInfo)}
{console.log(userInfo)}
<div className="row justify-content-center my-5"> <div className="row justify-content-center my-5">
<div className="col-sm-4 mb-3 "> <div className="col-sm-4 mb-3 ">
<h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>결제하기</h3> <h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>결제하기</h3>
...@@ -26,27 +50,40 @@ const Payment = ({ location }) => { ...@@ -26,27 +50,40 @@ const Payment = ({ location }) => {
</div> </div>
<div className="row justify-content-center"> <div className="row justify-content-center">
<div className="col-sm-8 text-center"> <div className="col-sm-8 text-center">
{user?.id > 0
?
<div>
<h5 className="mb-3">회원정보</h5>
</div>
:
<div>
<h5 className="mb-3">비회원예매 정보입력</h5>
</div>
}
<h5 className="mb-3">결제방법</h5> <h5 className="mb-3">결제방법</h5>
<img src="/images/naverpay_button.png" /> <img src="/images/naverpay_button.png" />
<Kakaopay ticketInfo={ticketInfo} setTicketInfo={setTicketInfo} /> <Kakaopay ticketInfo={ticketInfo} setTicketInfo={setTicketInfo} />
<div className="my-5">
<button className="btn btn-warning" type="button" onClick={SendMail}>결제완료</button>
</div>
</div> </div>
<div className="col-sm-4 p-3 text-center rounded-3" style={{ backgroundColor: "#252525" }}> <div className="col-sm-4 p-3 text-center rounded-3" style={{ backgroundColor: "#252525" }}>
<img style={{ maxHeight: "10rem" }} src={`https://image.tmdb.org/t/p/original${ticketInfo.poster_path}`} alt="영화포스터" /> <img style={{ maxHeight: "10rem" }} src={`https://image.tmdb.org/t/p/original${ticketInfo.poster_path}`} alt="영화포스터" />
<h5 className="my-3">{ticketInfo.title}</h5> <h5 className="my-3">{ticketInfo.title}</h5>
<div>{ticketInfo.theater}</div> <div>{ticketInfo.cinema}</div>
<div>{ticketInfo.time}</div> <div>{ticketInfo.time}</div>
<div className="mb-3">{ticketInfo.selectedCinemaNum} {ticketInfo.selectedSeats}</div> <div className="mb-3">{ticketInfo.selectedTheater} {ticketInfo.selectedSeats}</div>
<div className="rounded-3 p-3" style={{backgroundColor:'#404040'}}> <div className="rounded-3 p-3" style={{ backgroundColor: '#404040' }}>
<div>청소년: {ticketInfo.teenager}</div> <div>청소년: {ticketInfo.teenager}</div>
<div>성인: {ticketInfo.adult}</div> <div>성인: {ticketInfo.adult}</div>
<div>경로우대: {ticketInfo.elderly}</div> <div>경로우대: {ticketInfo.elderly}</div>
<div> 결제금액: {ticketInfo.teenager*7000 +ticketInfo.adult*8000+ticketInfo.elderly*6000}</div> <div> 결제금액: {ticketInfo.teenager * 7000 + ticketInfo.adult * 8000 + ticketInfo.elderly * 6000}</div>
</div> </div>
</div> </div>
</div> </div>
<div>
<button type="button" name="jiwon5393@naver.com" onClick={SendMail}>메일발송</button>
</div>
</div> </div>
) )
} }
......
import axios from 'axios'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import movieApi from '../apis/movie.api.js' import movieApi from '../apis/movie.api.js'
...@@ -8,16 +9,17 @@ import TicketingTimeTable from "../components/TicketingTimeTable/TicketingTimeTa ...@@ -8,16 +9,17 @@ import TicketingTimeTable from "../components/TicketingTimeTable/TicketingTimeTa
const TicketingPage = ({ location }) => { const TicketingPage = ({ location }) => {
const [ticketInfo, setTicketInfo] = useState({ const [ticketInfo, setTicketInfo] = useState({
...location.state, ...location.state,
theater:"", cinema:"",
selectedCinemaNum: 3, selectedTheater: 1,
time: "2021/07/21 10:00" time: "2021/07/21 10:00"
}) })
const [theaterInfo, setTheaterInfo] = useState({ const [cinemaInfo, setCinemaInfo] = useState({})
theater: ["Butter Studio 조치원"],
cinemaNum: [1, 2, 3, 4]
})
const [movieInfo, setMovieInfo] = useState() const [movieInfo, setMovieInfo] = useState()
useEffect(() => {
getCinemaInfo()
}, [])
useEffect(() => { useEffect(() => {
getMovieInfo() getMovieInfo()
}, [ticketInfo]) }, [ticketInfo])
...@@ -30,7 +32,15 @@ const TicketingPage = ({ location }) => { ...@@ -30,7 +32,15 @@ const TicketingPage = ({ location }) => {
console.log(error) console.log(error)
} }
} }
async function getCinemaInfo() {
try {
const response = await axios.get('/api/info/cinema')
console.log(response.data)
setCinemaInfo(response.data)
} catch (error) {
console.log(error)
}
}
return ( return (
<div className="container" style={{ backgroundColor: "black" }}> <div className="container" style={{ backgroundColor: "black" }}>
<div> <div>
...@@ -43,11 +53,11 @@ const TicketingPage = ({ location }) => { ...@@ -43,11 +53,11 @@ const TicketingPage = ({ location }) => {
</div> </div>
<div className="col-sm-3 mb-4 "> <div className="col-sm-3 mb-4 ">
<h3 className="py-2 mb-3 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>극장</h3> <h3 className="py-2 mb-3 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>극장</h3>
<TicketingTheater theaterInfo={theaterInfo} ticketInfo={ticketInfo} setTicketInfo={setTicketInfo} /> <TicketingTheater cinemaInfo={cinemaInfo} ticketInfo={ticketInfo} setTicketInfo={setTicketInfo} />
</div> </div>
<div className="col-sm-5 mb-4 "> <div className="col-sm-5 mb-4 ">
<h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>시간표</h3> <h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>시간표</h3>
<TicketingTimeTable ticketInfo={ticketInfo} theaterInfo={theaterInfo} /> <TicketingTimeTable ticketInfo={ticketInfo} cinemaInfo={cinemaInfo} />
</div> </div>
</div> </div>
<div className="row p-3" style={{ backgroundColor: "#252525"}}> <div className="row p-3" style={{ backgroundColor: "#252525"}}>
...@@ -58,18 +68,18 @@ const TicketingPage = ({ location }) => { ...@@ -58,18 +68,18 @@ const TicketingPage = ({ location }) => {
</div> </div>
<div className="col-sm-6 border-end" style={{ color: "white" }}> <div className="col-sm-6 border-end" style={{ color: "white" }}>
<div className="mb-2 text-center">극장선택</div> <div className="mb-2 text-center">극장선택</div>
{movieInfo && ticketInfo.theater {movieInfo && ticketInfo.cinema
? <ul> ? <ul>
<li>영화: {movieInfo.title}</li> <li>영화: {movieInfo.title}</li>
<li>극장: {ticketInfo.theater}</li> <li>극장: {ticketInfo.cinema}</li>
<li>일시: {ticketInfo.time}</li> <li>일시: {ticketInfo.time}</li>
<li>상영관: {ticketInfo.selectedCinemaNum}</li> <li>상영관: {ticketInfo.selectedTheater}</li>
</ul> </ul>
: <div></div>} : <div></div>}
</div> </div>
<div className="col-sm-3 text-center"> <div className="col-sm-3 text-center">
<div className="mb-2" style={{ color: "white" }}>좌석선택</div> <div className="mb-2" style={{ color: "white" }}>좌석선택</div>
{movieInfo && ticketInfo.theater {movieInfo && ticketInfo.cinema
? ?
<Link to={{ <Link to={{
pathname: `/ticket/seat`, pathname: `/ticket/seat`,
......
import { Link } from 'react-router-dom' import { Link, useHistory } from 'react-router-dom'
import { useState } from 'react' import { useState, useEffect, useRef } from 'react'
import { Modal } from 'bootstrap'
import CountButton from '../components/CountButton' import CountButton from '../components/CountButton'
import SeatTable from '../components/SeatTable/SeatTable' import SeatTable from '../components/SeatTable/SeatTable'
import styles from '../components/SeatTable/seatTable.module.scss'
import axios from 'axios'
import { useAuth } from '../context/auth_context.js'
const TicketingSeatPage = ({ location }) => { const TicketingSeatPage = ({ location }) => {
const history = useHistory()
const modalRef = useRef(null)
const modal = useRef()
const { user } = useAuth()
const [ticketInfo, setTicketInfo] = useState({ ...location.state }) const [ticketInfo, setTicketInfo] = useState({ ...location.state })
const [theaterInfo, setTheaterInfo] = useState()
const [selectedSeats, setSelectedSeats] = useState([]) const [selectedSeats, setSelectedSeats] = useState([])
const [reservedSeats, setReservedSeats] = useState([])
const [count, setCount] = useState({ const [count, setCount] = useState({
adult: 0, adult: 0,
teenager: 0, teenager: 0,
elderly: 0 elderly: 0
}) })
const allSeat = { row: 6, col: 10 }
useEffect(() => {
getInfo()
}, [])
async function getInfo() {
try {
const response = await axios.post('/api/theater/getInfo', {
theaterNum: ticketInfo.selectedTheater
})
console.log(response.data)
setTheaterInfo(response.data)
const response2 = await axios.post('/api/reservation/findreservation', {
timetable: 1
})
console.log(response2.data)
const reserve = response2.data.map((el) =>
el.row + '-' + el.col
)
setReservedSeats(reserve)
} catch (error) {
console.log(error)
}
}
function loginModal() {
if (user) {
history.push("/payment", {
...ticketInfo, selectedSeats: selectedSeats, ...count
});
} else {
modal.current = new Modal(modalRef.current)
modal.current?.show()
}
}
return ( return (
<>
<div ref={modalRef} className="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden={modal}>
<div className="modal-dialog">
<div className="modal-content">
{ }
<div className="modal-header">
<h5 className="modal-title" id="staticBackdropLabel">로그인이 필요한 서비스입니다.</h5>
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div className="modal-body">
로그인을 하시겠습니까? 비회원예매로 진행하시겠습니까?
</div>
<div className="modal-footer">
<Link to={{ pathname: '/login' }}>
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal" >
로그인
</button>
</Link>
<Link to={{
pathname: `/payment`,
state: { ...ticketInfo, selectedSeats: selectedSeats, ...count }
}}>
<button type="button" className="btn btn-primary" data-bs-dismiss="modal">비회원예매</button>
</Link>
</div>
</div>
</div>
</div>
<div className="container" style={{ color: "white" }}> <div className="container" style={{ color: "white" }}>
{console.log(ticketInfo)} {console.log(ticketInfo)}
{console.log(reservedSeats)}
<div className="row justify-content-center my-5"> <div className="row justify-content-center my-5">
<div className="col-sm-4 mb-3 "> <div className="col-sm-4 mb-3 ">
<h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>좌석선택</h3> <h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>좌석선택</h3>
...@@ -35,29 +109,26 @@ const TicketingSeatPage = ({ location }) => { ...@@ -35,29 +109,26 @@ const TicketingSeatPage = ({ location }) => {
<CountButton name="elderly" count={count} setCount={setCount} /> <CountButton name="elderly" count={count} setCount={setCount} />
</div> </div>
</div> </div>
{/* <span className="">일반</span>
<CountButton name="adult" count={count} setCount={setCount} />
<span className="">청소년</span>
<CountButton name="teenager" count={count} setCount={setCount} />
<span className="">경로우대</span>
<CountButton name="elderly" count={count} setCount={setCount} /> */}
</div> </div>
<div className="col-sm-6 mb-4 p-2 text-center" style={{ backgroundColor: '#252525' }}> <div className="col-sm-6 mb-4 p-2 text-center" style={{ backgroundColor: '#252525' }}>
<div>{ticketInfo.theater} | {ticketInfo.selectedCinemaNum}</div> <div>{ticketInfo.cinema} | {ticketInfo.selectedTheater}</div>
<div>{ticketInfo.title}</div> <div>{ticketInfo.title}</div>
<div>{ticketInfo.time}</div> <div>{ticketInfo.time}</div>
</div> </div>
</div> </div>
<div className="row justify-content-center border p-5 "> <div className="row justify-content-center border p-5 ">
<div className="col-sm-8"> <div className="col-sm-8">
<SeatTable count={count} setSelectedSeats={setSelectedSeats} selectedSeats={selectedSeats} allSeat={allSeat} /> <SeatTable count={count} setSelectedSeats={setSelectedSeats} selectedSeats={selectedSeats} theaterInfo={theaterInfo} reservedSeats={reservedSeats} />
</div> </div>
<div className="col-sm-4 mt-5"> <div className="col-sm-4 mt-5">
<p>선택됨</p> <div>
<p>선택불가</p> <button className={styles.on} style={{ height: '1rem', width: '1rem' }} disabled></button>
<span> 선택됨</span>
</div>
<div>
<button className={styles.btnBlock} style={{ height: '1rem', width: '1rem' }} disabled></button>
<span> 선택불가</span>
</div>
</div> </div>
</div> </div>
<div className="row p-3 mt-5" style={{ backgroundColor: "#252525" }}> <div className="row p-3 mt-5" style={{ backgroundColor: "#252525" }}>
...@@ -71,7 +142,7 @@ const TicketingSeatPage = ({ location }) => { ...@@ -71,7 +142,7 @@ const TicketingSeatPage = ({ location }) => {
{ticketInfo {ticketInfo
? <ul> ? <ul>
<li>영화: {ticketInfo.title}</li> <li>영화: {ticketInfo.title}</li>
<li>극장: {ticketInfo.theater}</li> <li>극장: {ticketInfo.cinema}</li>
<li>일시: 2021/07/21 10:00 </li> <li>일시: 2021/07/21 10:00 </li>
<li>상영관: 3</li> <li>상영관: 3</li>
<li>좌석: {selectedSeats}</li> <li>좌석: {selectedSeats}</li>
...@@ -82,19 +153,19 @@ const TicketingSeatPage = ({ location }) => { ...@@ -82,19 +153,19 @@ const TicketingSeatPage = ({ location }) => {
<div className="mb-2" style={{ color: "white" }}>결제하기</div> <div className="mb-2" style={{ color: "white" }}>결제하기</div>
{ticketInfo {ticketInfo
? ?
<Link to={{ <button onClick={loginModal} style={{ backgroundColor: '#252525', border: 0 }} >
pathname: `/payment`, <img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="결제하기" />
state: { ...ticketInfo, selectedSeats: selectedSeats, ...count } </button>
}}>
<img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="예매하기" />
</Link>
: :
<img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="예매하기" /> <button disabled>
<img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="결제하기" />
</button>
} }
</div> </div>
</div> </div>
</div> </div>
</>
) )
} }
......
...@@ -39,29 +39,6 @@ ...@@ -39,29 +39,6 @@
"negotiator": "0.6.2" "negotiator": "0.6.2"
} }
}, },
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"requires": {
"debug": "4"
},
"dependencies": {
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"ansi-align": { "ansi-align": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz",
...@@ -124,11 +101,6 @@ ...@@ -124,11 +101,6 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
}, },
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
},
"axios": { "axios": {
"version": "0.21.1", "version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
...@@ -267,15 +239,6 @@ ...@@ -267,15 +239,6 @@
} }
} }
}, },
"call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"camelcase": { "camelcase": {
"version": "5.3.1", "version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
...@@ -464,11 +427,6 @@ ...@@ -464,11 +427,6 @@
"integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==",
"dev": true "dev": true
}, },
"dayjs": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.6.tgz",
"integrity": "sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw=="
},
"debug": { "debug": {
"version": "2.6.9", "version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
...@@ -673,21 +631,6 @@ ...@@ -673,21 +631,6 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"get-stream": { "get-stream": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
...@@ -740,25 +683,12 @@ ...@@ -740,25 +683,12 @@
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
"dev": true "dev": true
}, },
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"requires": {
"function-bind": "^1.1.1"
}
},
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true "dev": true
}, },
"has-symbols": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
},
"has-yarn": { "has-yarn": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz",
...@@ -783,30 +713,6 @@ ...@@ -783,30 +713,6 @@
"toidentifier": "1.0.0" "toidentifier": "1.0.0"
} }
}, },
"https-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",
"requires": {
"agent-base": "6",
"debug": "4"
},
"dependencies": {
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"iconv-lite": { "iconv-lite": {
"version": "0.4.24", "version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
...@@ -1247,11 +1153,6 @@ ...@@ -1247,11 +1153,6 @@
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
}, },
"object-inspect": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz",
"integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg=="
},
"on-finished": { "on-finished": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
...@@ -1378,11 +1279,6 @@ ...@@ -1378,11 +1279,6 @@
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
"dev": true "dev": true
}, },
"pop-iterate": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz",
"integrity": "sha1-zqz9q0q/NT16DyqqLB/Hs/lBO6M="
},
"postgres-array": { "postgres-array": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
...@@ -1451,26 +1347,11 @@ ...@@ -1451,26 +1347,11 @@
"escape-goat": "^2.0.0" "escape-goat": "^2.0.0"
} }
}, },
"q": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz",
"integrity": "sha1-dbjbAlWhpa+C9Yw/Oqoe/sfQ0TQ=",
"requires": {
"asap": "^2.0.0",
"pop-iterate": "^1.0.1",
"weak-map": "^1.0.5"
}
},
"qs": { "qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}, },
"querystringify": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
},
"range-parser": { "range-parser": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -1537,11 +1418,6 @@ ...@@ -1537,11 +1418,6 @@
"rc": "^1.2.8" "rc": "^1.2.8"
} }
}, },
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
},
"responselike": { "responselike": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
...@@ -1559,11 +1435,6 @@ ...@@ -1559,11 +1435,6 @@
"any-promise": "^1.3.0" "any-promise": "^1.3.0"
} }
}, },
"rootpath": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz",
"integrity": "sha1-Wzeah9ypBum5HWkKWZQ5vvJn6ms="
},
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
...@@ -1574,11 +1445,6 @@ ...@@ -1574,11 +1445,6 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"scmp": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz",
"integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q=="
},
"semver": { "semver": {
"version": "5.7.1", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
...@@ -1692,16 +1558,6 @@ ...@@ -1692,16 +1558,6 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
}, },
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"requires": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
}
},
"signal-exit": { "signal-exit": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
...@@ -1860,34 +1716,6 @@ ...@@ -1860,34 +1716,6 @@
"nopt": "~1.0.10" "nopt": "~1.0.10"
} }
}, },
"twilio": {
"version": "3.66.0",
"resolved": "https://registry.npmjs.org/twilio/-/twilio-3.66.0.tgz",
"integrity": "sha512-2jek7akXcRMusoR20EWA1+e5TQp9Ahosvo81wTUoeS7H24A1xbVQJV4LfSWQN4DLUY1oZ4d6tH2oCe/+ELcpNA==",
"requires": {
"axios": "^0.21.1",
"dayjs": "^1.8.29",
"https-proxy-agent": "^5.0.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"q": "2.0.x",
"qs": "^6.9.4",
"rootpath": "^0.1.2",
"scmp": "^2.1.0",
"url-parse": "^1.5.0",
"xmlbuilder": "^13.0.2"
},
"dependencies": {
"qs": {
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
"integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
"requires": {
"side-channel": "^1.0.4"
}
}
}
},
"type-fest": { "type-fest": {
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
...@@ -1966,15 +1794,6 @@ ...@@ -1966,15 +1794,6 @@
"xdg-basedir": "^4.0.0" "xdg-basedir": "^4.0.0"
} }
}, },
"url-parse": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
"requires": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
}
},
"url-parse-lax": { "url-parse-lax": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
...@@ -2009,11 +1828,6 @@ ...@@ -2009,11 +1828,6 @@
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}, },
"weak-map": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz",
"integrity": "sha1-eWkVhNmGB/UHC9O3CkDmuyLkAes="
},
"widest-line": { "widest-line": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz",
...@@ -2055,11 +1869,6 @@ ...@@ -2055,11 +1869,6 @@
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
"dev": true "dev": true
}, },
"xmlbuilder": {
"version": "13.0.2",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz",
"integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ=="
},
"xtend": { "xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
"nodemailer": "^6.6.3", "nodemailer": "^6.6.3",
"pg": "^8.6.0", "pg": "^8.6.0",
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
"sequelize": "^6.6.4", "sequelize": "^6.6.4"
"twilio": "^3.66.0"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^2.0.12" "nodemon": "^2.0.12"
......
...@@ -6,6 +6,7 @@ const getAll = async (req, res) => { ...@@ -6,6 +6,7 @@ const getAll = async (req, res) => {
where: { id: 1 }, where: { id: 1 },
attributes: ['cinemaName', 'transportation', 'parking', 'address', 'moreFeeInfo'] attributes: ['cinemaName', 'transportation', 'parking', 'address', 'moreFeeInfo']
}) })
console.log("INfo====",info)
return res.json(info) return res.json(info)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "영화관 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "영화관 정보 가져오는 중 에러 발생")
......
import nodemailer from "nodemailer" import nodemailer from "nodemailer"
const SendMail = async (req,res) => { const SendMail = async (req,res) => {
// console.log(req.body) const {email, title, cinema,selectedTheater, time, nickname} = req.body
const {email} = req.body const selectedSeats = req.body.selectedSeats
console.log(email) const sendMail = async (email,title, cinema,selectedTheater, time, nickname, selectedSeats) => {
const sendMail = async (email) => {
// 메일을 전달해줄 객체 // 메일을 전달해줄 객체
const transporter = nodemailer.createTransport({ const transporter = nodemailer.createTransport({
// service: "gmail",
host: 'smtp.gmail.com', host: 'smtp.gmail.com',
port: 465, port: 465,
secure: true, secure: true,
...@@ -16,7 +14,6 @@ const SendMail = async (req,res) => { ...@@ -16,7 +14,6 @@ const SendMail = async (req,res) => {
user: "angelayoon99@gmail.com", user: "angelayoon99@gmail.com",
clientId: process.env.GMAIL_CLIENTID, clientId: process.env.GMAIL_CLIENTID,
clientSecret: process.env.GMAIL_CLIENTSECRET, clientSecret: process.env.GMAIL_CLIENTSECRET,
accessToken: process.env.GMAIL_ACCESS_TOKEN,
refreshToken: process.env.GMAIL_REFRESH_TOKEN, refreshToken: process.env.GMAIL_REFRESH_TOKEN,
}, },
tls: { tls: {
...@@ -26,10 +23,10 @@ const SendMail = async (req,res) => { ...@@ -26,10 +23,10 @@ const SendMail = async (req,res) => {
// 메일 옵션 // 메일 옵션
const mailOptions = { const mailOptions = {
from: `윤지원 <angelayoon99@gmail.com>`, from: `${cinema} <angelayoon99@gmail.com>`,
to: "jiwon5393@naver.com", to: `${email}`,
subject: "사용자 계정 확인용 메일.", subject: `${cinema} 예매확인내역: ${title}`,
text: "Test Mail from Test Server.", text: `${nickname}님의 예매: ${title} / ${cinema} / ${selectedTheater}관 / 일시: ${time} / ${selectedSeats} /`,
}; };
// 메일 전송 // 메일 전송
...@@ -42,7 +39,7 @@ const SendMail = async (req,res) => { ...@@ -42,7 +39,7 @@ const SendMail = async (req,res) => {
} }
} }
sendMail(email); sendMail(email,title, cinema,selectedTheater, time, nickname, selectedSeats);
} }
......
import axios from 'axios'
import { Reservation,Theater } from '../db/index.js'
import sequelize from 'sequelize'
const { Op } = sequelize
const findReservation = async (req,res) => {
const {timetable} = req.body
try {
const reservedSeats = await Reservation.findAll({
where: {
timetable:timetable
}
})
console.log(reservedSeats)
res.json(reservedSeats)
} catch (error) {
return res.status(500).send(error.message || "이미 예매되어있는 좌석을 찾는 중 오류발생")
}
}
export default {findReservation}
\ No newline at end of file
import { Theater } from "../db/index.js";
const getTheaterInfo = async (req, res) => {
const {theaterNum} = req.body
try {
const theaterInfo = await Theater.findOne({
where: { theaterNum: theaterNum },
attributes: ['theaterNum', 'rows', 'columns', 'theaterType']
})
// console.log("theaterInfo====",theaterInfo)
return res.json(theaterInfo)
} catch (error) {
return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생")
}
}
export default {getTheaterInfo}
\ No newline at end of file
import jwt from "jsonwebtoken"; import jwt from "jsonwebtoken";
import config from "../config/app.config.js"; import config from "../config/app.config.js";
import { User, Role } from '../db/index.js'; import { User, Role } from '../db/index.js';
<<<<<<< HEAD
const getUser = async (req, res) => { const getUser = async (req, res) => {
try { try {
...@@ -16,6 +17,9 @@ const getUser = async (req, res) => { ...@@ -16,6 +17,9 @@ const getUser = async (req, res) => {
return res.status(500).send("유저를 가져오지 못했습니다."); return res.status(500).send("유저를 가져오지 못했습니다.");
} }
} }
=======
// import Twilio from "twilio";
>>>>>>> jiwon
const login = async (req, res) => { const login = async (req, res) => {
try { try {
...@@ -91,8 +95,8 @@ const compareId = async (req, res) => { ...@@ -91,8 +95,8 @@ const compareId = async (req, res) => {
} }
const confirmMbnum = async (req, res) => { const confirmMbnum = async (req, res) => {
const id = req.params.id; // const id = req.params.id;
const token = req.params.token; // const token = req.params.token;
// const client = Twilio(id, token); // const client = Twilio(id, token);
// // console.log(client); // // console.log(client);
...@@ -171,6 +175,7 @@ const comparePw = async (req, res) => { ...@@ -171,6 +175,7 @@ const comparePw = async (req, res) => {
} }
} }
<<<<<<< HEAD
const modifyUser = async (req, res) => { const modifyUser = async (req, res) => {
try { try {
const token = req.cookies.butterStudio; const token = req.cookies.butterStudio;
...@@ -197,6 +202,21 @@ const modifyUser = async (req, res) => { ...@@ -197,6 +202,21 @@ const modifyUser = async (req, res) => {
res.status(500).send("수정 에러. 나중에 다시 시도 해주세요"); res.status(500).send("수정 에러. 나중에 다시 시도 해주세요");
} }
}; };
=======
const getUserInfo = async (req,res)=>{
const {id} = req.body
console.log(id)
try {
const userInfo = await User.findOne({
where:{id:id},
attributes:["userId","email","nickname","birth","phoneNumber"]
})
res.json(userInfo)
} catch (error) {
console.log(error)
}
}
>>>>>>> jiwon
export default { export default {
getUser, getUser,
...@@ -206,6 +226,10 @@ export default { ...@@ -206,6 +226,10 @@ export default {
confirmMbnum, confirmMbnum,
signup, signup,
getNickName, getNickName,
<<<<<<< HEAD
comparePw, comparePw,
modifyUser modifyUser
=======
getUserInfo
>>>>>>> jiwon
} }
...@@ -30,7 +30,11 @@ sequelize ...@@ -30,7 +30,11 @@ sequelize
password: "admin!", password: "admin!",
roleId: adminRole?.id, roleId: adminRole?.id,
}); });
<<<<<<< HEAD
}else{} }else{}
=======
}
>>>>>>> jiwon
app.listen(appConfig.port, () => { app.listen(appConfig.port, () => {
console.log(`Server is running on port ${appConfig.port}`); console.log(`Server is running on port ${appConfig.port}`);
......
...@@ -18,7 +18,7 @@ const ReservationModel = (sequelize) => { ...@@ -18,7 +18,7 @@ const ReservationModel = (sequelize) => {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
}, },
row: { row: {
type: DataTypes.STRING, type: DataTypes.INTEGER,
}, },
col: { col: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
......
...@@ -11,7 +11,7 @@ const TheaterModel = (sequelize) => { ...@@ -11,7 +11,7 @@ const TheaterModel = (sequelize) => {
primaryKey: true, primaryKey: true,
}, },
rows: { rows: {
type: DataTypes.STRING, type: DataTypes.INTEGER,
}, },
columns: { columns: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
......
...@@ -4,6 +4,8 @@ import movieRouter from './movie.route.js' ...@@ -4,6 +4,8 @@ import movieRouter from './movie.route.js'
import cinemaRouter from "./cinema.route.js"; import cinemaRouter from "./cinema.route.js";
import kakaopayRouter from "./kakaopay.route.js"; import kakaopayRouter from "./kakaopay.route.js";
import emailRouter from './email.route.js' import emailRouter from './email.route.js'
import theaterRouter from './theater.route.js'
import reservationRouter from './reservation.route.js'
const router = express.Router(); const router = express.Router();
...@@ -12,5 +14,7 @@ router.use('/auth', userRouter) ...@@ -12,5 +14,7 @@ router.use('/auth', userRouter)
router.use('/kakaopay',kakaopayRouter) router.use('/kakaopay',kakaopayRouter)
router.use('/email',emailRouter) router.use('/email',emailRouter)
router.use('/info', cinemaRouter) router.use('/info', cinemaRouter)
router.use('/theater', theaterRouter)
router.use('/reservation', reservationRouter)
export default router; export default router;
\ No newline at end of file
import express from "express";
import ReservationCtrl from "../controllers/reservation.controller.js";
const router = express.Router();
router.route('/findreservation')
.post(ReservationCtrl.findReservation)
export default router;
\ No newline at end of file
import express from "express";
import theaterCtrl from "../controllers/theater.controller.js";
const router = express.Router();
router.route("/getInfo")
.post(theaterCtrl.getTheaterInfo)
export default router;
...@@ -40,4 +40,11 @@ router ...@@ -40,4 +40,11 @@ router
.route("/:id/:token") .route("/:id/:token")
.get(userCtrl.confirmMbnum) .get(userCtrl.confirmMbnum)
// router
// .route("/:iddd")
// .get(userCtrl.getNickName)
router.route('/getuserinfo')
.post(userCtrl.getUserInfo)
export default router; export default router;
\ 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