Commit fcabe7b8 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

Merge branch 'gyumin'

parents 4517a35f 731cc282
/node_modules
.env.development
.env
./upload
\ No newline at end of file
upload/
\ No newline at end of file
......@@ -32,13 +32,13 @@ const compareId = async (userId) => {
const confirmMbnum = async (phone) => {
const url = `${baseUrl}/api/auth/phone/${phone}`
const { data } = await axios.post(url)
const { data } = await axios.post(url);
return data
}
const confirmNum = async (num) => {
const url = `${baseUrl}/api/auth/num/${num}`
const { data } = await axios.get(url)
const confirmNum = async (confirmNum) => {
const url = `${baseUrl}/api/auth/num`
const { data } = await axios.post(url, confirmNum);
return data
}
......@@ -61,7 +61,8 @@ const comparePw = async (pw) => {
const modifyUser = async (user) => {
const url = `${baseUrl}/api/auth/modify`
await axios.post(url, user)
const { data } = await axios.post(url, user)
return data
}
const authApi = {
......
......@@ -8,6 +8,7 @@ const MyInfo = () => {
const [img, setImg] = useState("");
const [profile, setProfile] = useState("");
const [startTime, setStartTime] = useState("");
// 사용자 이름 가져오는 함수
const getMember = async () => {
const member = await authApi.getMember();
......@@ -22,16 +23,21 @@ const MyInfo = () => {
//변경할 데이터 입력받는 state
const [userRe, setUserRe] = useState({
userName: "",
userEmail: "",
userNickName: "",
userMbnum: "",
userPassword: "",
userRePassword: ""
})
const [confirmMb, setConfirmMb] = useState(false);
const [number, setNumber] = useState(null);
//각 타입별 error 유무 state
const [mbError,setMbError] = useState(false);
const [error, setError] = useState("");
const [errorMsg, setErrorMsg] = useState({
errorName: false,
errorEmail: false,
errorNickName: false,
errorMbnum: false,
......@@ -62,7 +68,6 @@ const MyInfo = () => {
}
const enterKey = (e) => {
if (e.key === "Enter") {
handleOnSummitVerify(e);
}
}
......@@ -105,6 +110,55 @@ const MyInfo = () => {
}
}
const handleOnClickMbnum = async (e) => {
e.preventDefault();
try {
setStartTime("");
setError("");
setLoading(true);
const phone = userRe.userMbnum;
console.log("phone : ", phone);
const message = await authApi.confirmMbnum(phone);
console.log("message : ", message);
if(message.isSuccess){
console.log("mberror: "+mbError);
setMbError("보냄");
setStartTime(message.startTime);
}
} catch (error) {
console.log('error'+ error)
}finally {
setLoading(false);
}
}
const handleOnChangeMb = (e) => {
setNumber(String(e.target.value));
}
const handleOnClickMbConfirm = async (e) => {
e.preventDefault();
try {
setError("");
setLoading(true);
console.log("startTime : ", startTime);
const confirmNum = {userMbnum : userRe.userMbnum, number : number, startTime : startTime};
console.log(confirmNum);
const message = await authApi.confirmNum(confirmNum);
console.log(message);
setMbError(message);
if(message === "성공"){
setConfirmMb(true);
console.log("인증완료");
}
} catch (error) {
catchErrors(error, setError);
}finally {
setLoading(false);
}
}
//비교하여 error메세지 반환
const vaildationData = (text, compareValue, error) => {
if (text !== compareValue) {
......@@ -121,8 +175,11 @@ const MyInfo = () => {
setErrorMsg(errorMsg => ({ ...errorMsg, [error]: false }));
}
}
//유효성 검사
const validation = () => {
//이름 유효성 검사
vaildationData((userRe.userName.length === 0), false, "errorName");
//별명 유효성 검사
vaildationData((userRe.userNickName.length === 0), false, "errorNickName");
// 휴대폰 유효성 검사
......@@ -133,31 +190,29 @@ const MyInfo = () => {
vaildationData(userRe.userPassword, userRe.userRePassword, "errorRePassword");
// 최종 유효성 검사
if ((Object.values(errorMsg).some((element) => (element)) === false)) {
if (!(Object.values(errorMsg).some((element) => (element)))) {
return true
} else {
return false
}
}
const handleOnSummit = async (e) => {
e.preventDefault();
try {
console.log('handle ?????')
setError(() => (""));
//처리가 될때까지 버튼(가입하기)이 안눌리게 지정
setLoading(() => (true));
console.log("userRe : " + userRe.userEmail);
//유효성 검사
let valid = validation();
console.log("valid :" + valid);
console.log('handle on submit', valid)
if (valid) {
const userData = userRe;
console.log(userData);
//서버로 전송
const process = await authApi.modifyUser(userData);
console.log("process : " + process);
const result = await authApi.modifyUser(userData);
console.log("result : " + result);
alert("회원정보 수정 완료");
valid = false;
} else { throw new Error("유효하지 않은 데이터입니다.") }
......@@ -190,8 +245,8 @@ const MyInfo = () => {
</div>
</div>
</div>
<div className="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
{/* 프로필 변경 모달창 */}
<div className="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabIndex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div className="modal-dialog modal-dialog-centered">
<form className="modal-content" onSubmit={handleOnSummitForm}>
<div className="modal-header">
......@@ -210,15 +265,15 @@ const MyInfo = () => {
</div>
{/* 기존 비밀번호 확인 모달창 */}
<div className="modal fade" id="verifyPassword" data-bs-backdrop="static" data-bs-keyboard="false" aria-hidden="true" aria-labelledby="verifyPasswordLabel" tabindex="-1">
<div className="modal fade" id="verifyPassword" data-bs-backdrop="static" data-bs-keyboard="false" aria-hidden="true" aria-labelledby="verifyPasswordLabel" tabIndex="-1">
<div className="modal-dialog modal-dialog-centered modal-dialog-centered">
{page ?
<><form className="modal-content" onSubmit={handleOnSummitVerify}>
<div className="modal-header">
<h5 className="modal-title" id="verifyPasswordLabel">기존 비밀번호 확인</h5>
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick={handleOnClick}></button>
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close" onClick={handleOnClick}></button>
</div>
<div clasNames="modal-body">
<div className="modal-body">
<div className="d-flex flex-column">
<div className="d-flex justify-content-around align-items-center my-4">
<label className={styles.signupLabel}>현재 비밀번호</label>
......@@ -233,13 +288,20 @@ const MyInfo = () => {
: <><form className={`modal-content d-flex col-md-6 col-12 justify-content-center d-flex flex-column`} onSubmit={handleOnSummit}>
<div className="modal-header">
<h5 className="modal-title" id="modifyLabel">회원정보 수정</h5>
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick={handleOnClick}></button>
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close" onClick={handleOnClick}></button>
</div>
<div className={`modal-body`}>
<div className="d-flex flex-column">
<div className={styles.inputContent}>
<label className={styles.signupLabel}>이름</label>
<input className={`${styles.input} ${styles.inputSize}`} type="text" name="userName" placeholder="이름을 입력해주세요" onChange={handleUserOnChange} maxLength="11" required />
</div>
{errorMsg.errorName && <p className={styles.passwordConfirmError}>이름을 입력해주세요</p>}
</div>
<div className="d-flex flex-column">
<div className={styles.inputContent}>
<label className={styles.signupLabel}>이메일</label>
<input className={`${styles.input} ${styles.inputSize}`} type="email" name="userEmail" placeholder="이메일을 입력해주세요" onChange={handleUserOnChange} maxlength="20" required />
<input className={`${styles.input} ${styles.inputSize}`} type="email" name="userEmail" placeholder="이메일을 입력해주세요" onChange={handleUserOnChange} maxLength="20" required />
</div>
{errorMsg.errorEmail && <p className={styles.passwordConfirmError}>이메일을 입력해주세요</p>}
</div>
......@@ -255,12 +317,29 @@ const MyInfo = () => {
<div className={styles.inputContent}>
<label className={styles.signupLabel}>휴대폰 번호</label>
<div className="d-flex col-md-auto">
<input className={`${styles.input} ${styles.inputSize}`} type="number" name="userMbnum" placeholder="-없이 11자리 입력" onChange={handleUserOnChange} min="" max="99999999999" required />
<input className={`${styles.input} `} type="number" name="userMbnum" placeholder="-없이 11자리 입력" onChange={handleUserOnChange} min="" max="99999999999" required />
<button type="button" disabled={loading} className={`rounded-2 mt-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample" onClick={handleOnClickMbnum}>인증번호받기</button>
</div>
</div>
{errorMsg.errorMbnum && <p className={styles.passwordConfirmError}>-없이 숫자 11자리를 입력해주세요.</p>}
<div className="collapse" id="collapseExample">
{/* <div className="d-flex col-md-auto justify-content-end"> */}
<div className="d-flex justify-content-around mt-3">
<label className={`${styles.confirm}`}>인증하기</label>
<div>
<input className={`${styles.input}`} type="number" placeholder="인증번호를 입력" onChange={handleOnChangeMb} required/>
<button type="button" className={`rounded-2 py-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} onClick={handleOnClickMbConfirm}>확인</button>
<button type="button" className={`rounded-2 py-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} onClick={handleOnClickMbnum}>재전송</button>
</div>
</div>
{(mbError === "재전송") && <p className={styles.passwordConfirmError}>유효시간이 만료되었습니다. 재전송해주세요.</p>}
{(mbError === "보냄") && <p className={styles.passwordConfirmError}>5분이내에 입력해주세요.</p>}
{(mbError === "성공") && <p className={styles.passwordConfirmError}>인증되었습니다.</p>}
{(mbError === "실패") && <p className={styles.passwordConfirmError}>인증번호를 다시 입력해주세요.</p>}
</div>
</div>
<div className="d-flex flex-column">
<div className={styles.inputContent}>
<label className={styles.signupLabel}> 비밀번호</label>
......
......@@ -2,10 +2,10 @@
display: flex;
justify-content: center;
color: #FEDC00;
font-size: 1.8rem;
font-size: 3rem;
margin: 2rem 0;
}
img{
.img{
width: 40%;
}
......@@ -22,7 +22,7 @@ width: 40%;
}
.userName{
color: white;
font-size: 1.3rem;
font-size: 1.8rem;
}
.contents{
......@@ -120,9 +120,11 @@ width: 40%;
.passwordConfirmError{
margin-bottom: 0;
margin-top: 0.5rem;
margin-right: 3rem;
text-align: end;
font-size: 13px;
color: #FEDC00;
font-weight: bold;
color: black;
}
@media (max-width: 403px) {
......
import styles from "./reservation-details.module.scss";
const ReservationDetails = () => {
return(
<div className={`${styles.width}`}>
<header className={`${styles.header}`}>나의 예매 내역</header>
<main>
</main>
</div>
return (
<div className={`d-flex flex-column align-items-center ${styles.width}`}>
<div className={`${styles.header}`}>나의 예매 내역</div>
<div className={`${styles.body}`}>
<div className={`d-flex justify-content-around align-items-center py-3`}>
<div className={`${styles.span} d-flex justify-content-center`}>
<span>영화 포스터</span>
</div>
<div className={`${styles.span} d-flex flex-column`}>
<span>영화제목</span>
<span>예매확인번호</span>
<span>예매날짜</span>
<span>상영관</span>
<span>좌석정보</span>
<span>결제금액</span>
<span>결제수단</span>
</div>
</div>
</div>
<div className={`${styles.header}`}>나의 리뷰</div>
</div>
)
}
......
.width{
width : 100%;
display: flex;
margin-top: 5rem;
justify-content: center;
}
.header{
display: flex;
......@@ -12,5 +10,15 @@
width: 80%;
text-align: center;
font-size: 2.5rem;
margin: 5rem;
}
.body{
width: 80%;
border-top: 1px solid #FEDC00;
border-bottom: 1px solid #FEDC00;
}
.span span{
color:white;
font-size: 1.5rem;
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import catchErrors from "../../utils/catchErrors.js";
const Signup = () => {
const [user, setUser] = useState({
userId: "",
userName:"",
userEmail: "",
userNickName: "",
userBirthday: "",
......@@ -14,7 +15,7 @@ const Signup = () => {
userPassword: "",
userRePassword: ""
})
const [startTime, setStartTime] = useState("");
const [number, setNumber] = useState(null);
const [loading, setLoading] = useState(false);
const [success, setSuccess] = useState(false);
......@@ -23,6 +24,7 @@ const Signup = () => {
const [error, setError] = useState("");
const [errorMsg, setErrorMsg] = useState({
errorId: null,
errorName: false,
errorEmail: false,
errorNickName: false,
errorBirthday: false,
......@@ -87,15 +89,18 @@ const Signup = () => {
const handleOnClickMbnum = async (e) => {
e.preventDefault();
try {
setStartTime("");
setError("");
setLoading(true)
const phone = user.userMbnum;
console.log("phone : ", phone)
console.log("phone : ", phone);
const message = await authApi.confirmMbnum(phone);
console.log("message : ", message);
if(message.isSuccess){
console.log("mberror: "+mbError);
setMbError("보냄");
setStartTime(message.startTime);
}
} catch (error) {
console.log('error'+ error)
......@@ -112,9 +117,10 @@ const Signup = () => {
e.preventDefault();
try {
setError("");
setLoading(true)
const confirmNum = number;
console.log(confirmNum)
setLoading(true);
console.log("startTime : ", startTime);
const confirmNum = {userMbnum : user.userMbnum, number : number, startTime : startTime};
console.log(confirmNum);
const message = await authApi.confirmNum(confirmNum);
console.log(message);
setMbError(message);
......@@ -129,6 +135,9 @@ const Signup = () => {
}
}
const handleOnSummit = async (e) => {
e.preventDefault();
try {
......@@ -176,6 +185,8 @@ const Signup = () => {
setPreId(user.userId);
//아이디 유효성 검사
vaildationIdPw(user.userId.length, 5, "errorId");
//이름 유효성 검사
vaildationData((user.userName.length === 0), false, "errorName");
//별명 유효성 검사
vaildationData((user.userNickName.length === 0), false, "errorNickName");
// 생일 유효성 검사
......@@ -228,6 +239,13 @@ const Signup = () => {
{overlapId && (errorMsg.errorId === false) && <p className={styles.passwordConfirmError}>아이디 중복이 확인되었습니다.</p>}
{(errorMsg.errorId === false) && (overlapId === false) && <p className={styles.passwordConfirmError}>아이디 중복확인을 해주세요.</p>}
</div>
<div className="d-flex flex-column">
<div className={styles.inputContent}>
<label className={styles.signupLabel}>이름</label>
<input className={`${styles.input} ${styles.inputSize}`} type="text" name="userName" placeholder="이름을 입력해주세요" onChange={handleUserOnChange} maxlength="10" required />
</div>
{errorMsg.errorName && <p className={styles.passwordConfirmError}>이름을 입력해주세요</p>}
</div>
<div className="d-flex flex-column">
<div className={styles.inputContent}>
<label className={styles.signupLabel}>이메일</label>
......@@ -266,7 +284,7 @@ const Signup = () => {
<div className="d-flex justify-content-between mt-3">
<label className={`${styles.confirm}`}>인증하기</label>
<div>
<input className={`${styles.input} ${styles.input2}`} type="number" placeholder="인증번호를 입력" onChange={handleOnChangeMb} require />
<input className={`${styles.input} ${styles.input2}`} type="number" placeholder="인증번호를 입력" onChange={handleOnChangeMb} required/>
<button type="button" className={`rounded-2 py-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} onClick={handleOnClickMbConfirm}>확인</button>
<button type="button" className={`rounded-2 py-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} onClick={handleOnClickMbnum}>재전송</button>
</div>
......
......@@ -60,7 +60,7 @@ const TicketingSeatPage = ({ location }) => {
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 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">
{ }
......
......@@ -4,6 +4,7 @@ const config = {
jwtSecret: 'dfkasf23i$efksdfks!',
jwtExpires: '7d',
cookieName: 'butterStudio',
cookieNameMb: 'confirmNum',
cookieMaxAge: 60 * 60 * 24 * 7 * 1000,
kakaoAdminKey: 'e3ce7106688a35e072e2630daa9d7250',
}
......
import jwt from "jsonwebtoken";
import config from "../config/app.config.js";
import { User, Role, Guest } from '../db/index.js';
import { User, Role, Guest,ConfirmNum } from '../db/index.js';
import fs from "fs";
import CryptoJS from "crypto-js";
import axios from "axios";
......@@ -95,7 +95,6 @@ const compareId = async (req, res) => {
}
// 휴대폰 인증
const NCP_serviceID = 'ncp:sms:kr:270376424445:butterstudio';
const NCP_accessKey = 'GQmVCT2ZFxnEaJOWbrQs';
const NCP_secretKey = 'XLQQ8sd9WxW40hNi0xNBTOG0T8ksRsr8c8sUIEvy';
......@@ -123,12 +122,8 @@ hmac.update(accessKey);
const hash = hmac.finalize();
const signature = hash.toString(CryptoJS.enc.Base64);
let inherentNum = "";
// 유효시간 5분 설정
const time = () => {
inherentNum = false;
return inherentNum
}
// 인증번호 발송
const confirmMbnum = async (req, res) => {
......@@ -139,39 +134,56 @@ const confirmMbnum = async (req, res) => {
//인증번호 생성
const verifyCode = Math.floor(Math.random() * (999999 - 100000)) + 100000;
console.log("verifyCode : ",verifyCode);
let result = await axios({
method: method,
json: true,
url: url,
headers: {
'Content-Type': "application/json",
'x-ncp-apigw-timestamp': date,
'x-ncp-iam-access-key': accessKey,
'x-ncp-apigw-signature-v2': signature,
},
data: {
type: 'SMS',
contentType: 'COMM',
countryCode: '82',
from: '01086074580',
content: `[본인 확인] 인증번호 [${verifyCode}]를 입력해주세요.`,
messages: [
{
to: `${phoneNumber}`,
},
],
},
});
const resultMs = result.data.messages;
console.log('resultMs', resultMs);
let today = new Date();
let time = String(today.getTime());
console.log("time : ", time);
// let result = await axios({
// method: method,
// json: true,
// url: url,
// headers: {
// 'Content-Type': "application/json",
// 'x-ncp-apigw-timestamp': date,
// 'x-ncp-iam-access-key': accessKey,
// 'x-ncp-apigw-signature-v2': signature,
// },
// data: {
// type: 'SMS',
// contentType: 'COMM',
// countryCode: '82',
// from: '01086074580',
// content: `[본인 확인] 인증번호 [${verifyCode}]를 입력해주세요.`,
// messages: [
// {
// to: `${phoneNumber}`,
// },
// ],
// },
// });
console.log('response', res.data, res['data']);
inherentNum = String(verifyCode);
// const resultMs = result.data.messages;
// console.log('resultMs', resultMs);
// 5분 유효시간 설정
setTimeout(time, 300000);
res.json({ isSuccess: true, code: 202, message: "본인인증 문자 발송 성공", result: res.data });
// console.log('response', res.data, res['data']);
const confirm = await ConfirmNum.findOne({ where: { phone: phoneNumber} });
console.log(confirm);
if(confirm){
await confirm.destroy();
// 5분 유효시간 설정
await ConfirmNum.create({
confirmNum: String(verifyCode),
phone: phoneNumber,
startTime: time,
});
}else{
await ConfirmNum.create({
confirmNum: String(verifyCode),
phone: phoneNumber,
startTime: time,
}
);
}
res.json({ startTime: time, isSuccess: true, code: 202, message: "본인인증 문자 발송 성공", result: res.data });
} catch (error) {
console.log("error: ", error);
if (error.res == undefined) {
......@@ -180,19 +192,30 @@ const confirmMbnum = async (req, res) => {
else res.json({ isSuccess: true, code: 204, message: "본인인증 문자 발송에 문제가 있습니다.", result: error.res });
}
};
// 인증번호 확인
const confirmNum = async (req, res) => {
try {
const verifyCode = inherentNum;
const confirmNum = req.params.num;
if(!verifyCode){
res.send("재전송")
}else{
if (confirmNum !== verifyCode) {
const {userMbnum, number, startTime} = req.body;
console.log(userMbnum, number, startTime);
const confirm = await ConfirmNum.findOne({ where: { phone: userMbnum, startTime: startTime} });
console.log(confirm);
let today = new Date();
let time = today.getTime();
console.log("time2 :", time);
const elapsedMSec = time - confirm.startTime;
const elapsedMin = String(elapsedMSec / 1000 / 60);
console.log("elapsedMin : ", elapsedMin);
if(elapsedMin <= 5 ){
if (number !== confirm.confirmNum) {
res.send("실패");
}else {
await confirm.destroy();
res.send("성공");
}
}else{
res.send("재전송")
}
} catch (error) {
console.error("error : ", error.message);
......@@ -201,10 +224,9 @@ const confirmNum = async (req, res) => {
};
const signup = async (req, res) => {
const { userId, userEmail, userNickName, userBirthday, userMbnum, userPassword } = req.body;
// 휴대폰 중복 확인
const { userId, userName, userEmail, userNickName, userBirthday, userMbnum, userPassword } = req.body;
try {
const mbnum = await User.findOne({ where: { phoneNumber: userMbnum } });
const mbnum = await User.findOne({ where: { phoneNumber: userMbnum }});
const email = await User.findOne({ where: { email: userEmail } });
if (mbnum && email) {
......@@ -217,6 +239,7 @@ const signup = async (req, res) => {
const role = await Role.findOne({ where: { name: "member" } })
const newUser = await User.create({
userId: userId,
name: userName,
email: userEmail,
nickname: userNickName,
birth: userBirthday,
......@@ -258,7 +281,6 @@ const uploadProfile = async (req, res) => {
if (decoded) {
const img = await User.findOne({ where: { id: decoded.id }, attributes: ["img"] });
console.log("여기여기");
fs.unlink("upload" + `\\${img.img}`, function (data) { console.log(data); });
const user = await User.update({
......@@ -304,7 +326,6 @@ const overlap = async (decoded, dataType, data) => {
let overlap = await User.findOne({ where: { id: decoded.id } });
console.log("기존 데이터 : ", overlap, "변경할 데이터 : ", data);
if (overlap[dataType] === data) {
console.log("여기여기")
return true
} else {
let overlap2 = await User.findOne({ attributes: [dataType] });
......@@ -324,21 +345,19 @@ const modifyUser = async (req, res) => {
try {
const token = req.cookies.butterStudio;
const decoded = jwt.verify(token, config.jwtSecret);
const { userEmail, userNickName, userMbnum, userPassword } = req.body;
console.log(userEmail);
console.log(userMbnum);
const { userName, userEmail, userNickName, userMbnum, userPassword } = req.body;
const overlapEmail = await overlap(decoded, "email", userEmail);
const overlapMbnum = await overlap(decoded, "phoneNumber", userMbnum);
console.log("overlapEmail", overlapEmail, " overlapMbnum : ", overlapMbnum);
if (overlapEmail && overlapMbnum) {
const user = await User.update({
name: userName,
email: userEmail,
nickname: userNickName,
phoneNumber: userMbnum,
password: userPassword,
}, { where: { id: decoded.id } });
}, { where: { id: decoded.id }, individualHooks: true });
console.log("user22 :", user);
res.json(user);
} else if (!overlapEmail && overlapMbnum) {
......@@ -353,6 +372,7 @@ const modifyUser = async (req, res) => {
res.status(500).send("수정 에러. 나중에 다시 시도 해주세요");
}
};
const getUserInfo = async (req, res) => {
const { id } = req.body
console.log(id)
......
......@@ -9,6 +9,7 @@ import TicketFeeModel from "../models/ticketfee.model.js";
import TimeTableModel from '../models/role.model.js';
import ReservationModel from '../models/reservation.model.js';
import GuestModel from '../models/guest.model.js'
import ConfirmNumModel from '../models/confirmnum.model.js'
import dbConfig from "../config/db.config.js";
const sequelize = new Sequelize(
......@@ -37,6 +38,7 @@ const TicketFee = TicketFeeModel(sequelize)
const TimeTable = TimeTableModel(sequelize)
const Reservation = ReservationModel(sequelize)
const Guest = GuestModel(sequelize)
const ConfirmNum = ConfirmNumModel(sequelize)
User.belongsTo(Role);
Role.hasOne(User);
......@@ -56,5 +58,6 @@ export {
TicketFee,
TimeTable,
Reservation,
Guest
Guest,
ConfirmNum
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ sequelize
if (!adminRole) {
await User.create({
userId: "admin",
name: "관리자",
email: "han35799@naver.com",
nickname: "haha",
birth: "990926",
......
import Sequelize from "sequelize";
const { DataTypes } = Sequelize;
const ConfirmNumModel = (sequelize) => {
const ConfirmNum = sequelize.define(
"confirmnum",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
confirmNum: {
type: DataTypes.STRING,
},
phone: {
type: DataTypes.STRING
},
startTime: {
type: DataTypes.STRING
},
},
{
timestamps: true,
freezeTableName: true,
tableName: "confirmnum"
}
);
return ConfirmNum;
};
export default ConfirmNumModel;
\ No newline at end of file
......@@ -16,6 +16,9 @@ const UserModel = (sequelize) => {
userId: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
email: {
type: DataTypes.STRING
},
......@@ -51,6 +54,7 @@ const UserModel = (sequelize) => {
);
User.beforeSave(async (user) => {
console.log('update before', user)
if (!user.changed("password")) {
return;
}
......
......@@ -33,7 +33,10 @@ router
router
.route("/member")
.get(userCtrl.getMember)
router
.route("/num")
.post(userCtrl.confirmNum)
router
.route("/pw/:pw")
.get(userCtrl.comparePw)
......@@ -46,9 +49,6 @@ router
.route("/phone/:phone")
.post(userCtrl.confirmMbnum)
router
.route("/num/:num")
.get(userCtrl.confirmNum)
router.route('/getuserinfo')
.post(userCtrl.getUserInfo)
......
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