Commit f23faf1e authored by 권병윤's avatar 권병윤
Browse files

Merge remote-tracking branch 'origin/seoyeon2' into byoungyun

parents 461f7743 945e73ff
import { Link, Route, Switch, useParams } from "react-router-dom";
const ChannelSingle = () => { const ChannelSingle = () => {
const { roomId } = useParams();
return ( return (
<div className="overflow-auto" style={{ height: '610px' }}> <div className="overflow-auto" style={{ height: "610px" }}>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <Link to={`${roomId}/meeting`}>
className="col-auto mt-2" <img
src="/fullSpeaker.png" className="col-auto mt-2"
width="25px" src="/fullSpeaker.png"
height="25px" width="25px"
/> height="25px"
<h5 className="col mt-2">회의</h5> />
</div> <h5 className="col mt-2" style={{ color: "black" }}>
<ul className="mx-5" style={{ color: '#76D079' }}> 회의
<li> </h5>
<p style={{ color: 'black' }}>CHERRY</p> </Link>
</li>
<li>
<p style={{ color: 'black' }}>JAEYEON</p>
</li>
<li>
<p style={{ color: 'black' }}>SEOYEON</p>
</li>
<li>
<p style={{ color: 'black' }}>JIWEON</p>
</li>
<li>
<p style={{ color: 'black' }}>BYOUNGYUN</p>
</li>
</ul>
</div>
<div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}>
<img
className="col-auto mt-2"
src="/emptySpeaker.png"
width="25px"
height="25px"
/>
<h5 className="col mt-2">사담</h5>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <img
className="col-auto mt-2" className="col-auto mt-2"
src="/emptySpeaker.png" src="/emptySpeaker.png"
width="25px" width="25px"
height="25px" height="25px"
/> />
<h5 className="col mt-2">일반</h5> <Link to={`${roomId}/normal`}>
<h5 className="col mt-2" style={{ color: "black" }}>
일반
</h5>
</Link>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <img
className="col-auto mt-2" className="col-auto mt-2"
src="/emptySpeaker.png" src="/emptySpeaker.png"
width="25px" width="25px"
height="25px" height="25px"
/> />
<h5 className="col mt-2">공지</h5> <Link to={`${roomId}/notice`}>
<h5 className="col mt-2" style={{ color: "black" }}>
공지
</h5>
</Link>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
) );
} };
export default ChannelSingle export default ChannelSingle;
import ScreenSelect from './ScreenSelect' import ScreenSelect from './ScreenSelect'
import video_btn from '../../images/videobtn.png'
import speaker_btn from '../../images/speakerbtn.png'
import mic_btn from '../../images/micbtn.png'
import videooff_btn from '../../images/videooffbtn.png'
import speakeroff_btn from '../../images/speakeroffbtn.png'
import micoff_btn from '../../images/micoffbtn.png'
import React, { useState } from 'react'; import React, { useState } from 'react';
const Controller = () => { const Controller = () => {
const [mic, setMic] = useState("true") const [mic, setMic] = useState(true)
const [speaker, setSpeaker] = useState("true") const [speaker, setSpeaker] = useState(true)
const [video, setVideo] = useState("true") const [video, setVideo] = useState(true)
const micOn = (() => setMic(false)); const micOn = (() => setMic(false));
const micOff = (() => setMic(true)); const micOff = (() => setMic(true));
...@@ -29,22 +23,22 @@ const Controller = () => { ...@@ -29,22 +23,22 @@ const Controller = () => {
{mic ? <div className="col d-flex justify-content-center"> {mic ? <div className="col d-flex justify-content-center">
<button type="button" className="btn" onClick={micOn}> <button type="button" className="btn" onClick={micOn}>
<img src={micoff_btn} width="45" height="40" /> <img src="/micoffbtn.png" width="45" height="40" />
</button> </button>
</div> </div>
: <div className="col d-flex justify-content-center"> : <div className="col d-flex justify-content-center">
<button type="button" className="btn" onClick={micOff}> <button type="button" className="btn" onClick={micOff}>
<img src={mic_btn} width="45" height="40" /> <img src="/micbtn.png" width="45" height="40" />
</button> </button>
</div> </div>
} }
{speaker ? <div className="col d-flex justify-content-center"> {speaker ? <div className="col d-flex justify-content-center">
<button type="button" className="btn" onClick={speakerOn}> <button type="button" className="btn" onClick={speakerOn}>
<img src={speakeroff_btn} width="45" /> <img src="/speakeroffbtn.png" width="45" />
</button> </button>
</div> : <div className="col d-flex justify-content-center"> </div> : <div className="col d-flex justify-content-center">
<button type="button" className="btn" onClick={speakerOff}> <button type="button" className="btn" onClick={speakerOff}>
<img src={speaker_btn} width="45" /> <img src="/speakerbtn.png" width="45" />
</button> </button>
</div> </div>
} }
...@@ -57,12 +51,12 @@ const Controller = () => { ...@@ -57,12 +51,12 @@ const Controller = () => {
onClick="location.href='ScreenSelect.js'" onClick="location.href='ScreenSelect.js'"
onClick={videoOn} onClick={videoOn}
> >
<img src={videooff_btn} width="45" /> <img src="/videooffbtn.png" width="45" />
</button> </button>
</div> : </div> :
<div className="col d-flex justify-content-center"> <div className="col d-flex justify-content-center">
<button type="button" className="btn" onClick={videoOff}> <button type="button" className="btn" onClick={videoOff}>
<img src={video_btn} width="45" /> <img src="/videobtn.png" width="45" />
</button> </button>
</div>} </div>}
</div> </div>
......
...@@ -86,9 +86,23 @@ const LeftHamburger = () => { ...@@ -86,9 +86,23 @@ const LeftHamburger = () => {
aria-labelledby="InviteRoomLabel" aria-labelledby="InviteRoomLabel"
aria-hidden="true" aria-hidden="true"
> >
<div className="modal-dialog"> <div className="offcanvas-header">
<div className="modal-content"> <p
<div className="modal-header"> className="col-6 offcanvas-title"
id="offcanvasExampleLabel"
style={{
fontWeight: "bold",
fontSize: "15px",
width: "150px",
color: "#000000",
}}
>
/오프라인 사용자
</p>
<h6 className="mt-2" id="roomId">
{" "}
{" "}
</h6>
<button <button
type="button" type="button"
className="btn-close" className="btn-close"
......
...@@ -135,7 +135,7 @@ const RightHamburger = () => { ...@@ -135,7 +135,7 @@ const RightHamburger = () => {
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="d-flex justify-content-evenly"> <div className="d-flex justify-content-evenly">
{/* <Link to="/user"> */} {/* <Link to="/user/:id"> */}
<button <button
type="submit" type="submit"
className="col-2 p-1 btn btn-primary" className="col-2 p-1 btn btn-primary"
......
...@@ -2,7 +2,7 @@ const User = () => { ...@@ -2,7 +2,7 @@ const User = () => {
return ( return (
<div className="container"> <div className="container">
<div className="row"> <div className="row">
<div className="col" style={{ backgroundColor: "#DEC7F5", position:'absolute', bottom:'58px', width: '414px'}}> <div className="col" style={{ backgroundColor: "#ded0fa", position:'absolute', bottom:'58px', width: '414px'}}>
<p <p
className="m-2" className="m-2"
style={{ fontWeight: "bold", color: "#4A4251", fontSize: "20px" }} style={{ fontWeight: "bold", color: "#4A4251", fontSize: "20px" }}
......
import { useEffect, useState } from "react"; import axios from 'axios'
import { Redirect } from "react-router-dom"; import { useEffect, useState } from 'react'
import userApi from "../apis/user.api"; import { Link, Redirect } from 'react-router-dom'
// import catchErrors from "../context/catchError"; import userApi from '../apis/user.api'
// import auth from "../context/auth_context" import catchErrors from '../context/catchError'
const INIT_USER = { const INIT_USER = {
name: "", name: '',
idNumber1: "", email: '',
idNumber2: "", password: '',
email: "", checkpw: '',
password: "", phone: '',
checkpw: "", }
phone: "",
};
const Signup = () => { const Signup = () => {
const [user, setUser] = useState(INIT_USER); const [user, setUser] = useState(INIT_USER)
const [error, setError] = useState(""); const [error, setError] = useState('')
const [disabled, setDisabled] = useState(false); const [disabled, setDisabled] = useState(false)
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false)
const [loading, setLoading] = useState(false);
useEffect(() => { useEffect(() => {
setDisabled( setDisabled(!(user.name && user.email && user.password && user.checkpw))
!( }, [user])
user.name &&
user.idNumber1 &&
user.idNumber2 &&
user.email &&
user.password &&
user.checkpw
)
);
}, [user]);
function handleChange(event) { function handleChange(event) {
const { name, value } = event.target; const { name, value } = event.target
setUser({ ...user, [name]: value }); setUser({ ...user, [name]: value })
// console.log(user);
} }
async function handleSubmit() { async function handleSubmit(e) {
console.log(user) e.preventDefault()
console.log('회원가입')
try { try {
const data = await userApi.signup(user) if (checkPassword()) {
setLoading(true); const data = await userApi.signup(user)
setError(""); console.log(data)
// const success = await login(user.email, user.password); setSuccess(true)
// const data = await axios.post("/api/room/1/1",user) setError('')
console.log(data); }
setSuccess(true);
} catch (error) { } catch (error) {
// catchErrors(error, setError); console.log('error')
catchErrors(error, setError)
} finally { } finally {
setLoading(false); setLoading(false);
} }
} }
function checkPassword(event) {
const p1 = user.password
const p2 = user.checkpw
if (p1 !== p2) {
// event.preventDefault()
alert('비밀번호가 일치하지 않습니다.')
window.location.href = '/login'
return false
} else {
// alert('회원가입 되었습니다.')
// window.location.href = '/'
return true
}
}
if (success) { if(success) {
alert('회원가입 되었습니다.') alert('회원가입 되었습니다.')
return <Redirect to="/" />; window.location.href = '/'
} }
const { name, id, password, checkpw, phone } = user
const { name, idNumber1, idNumber2, id, password, checkpw, phone } = user;
return ( return (
<div className="modal-content"> <div className="container">
{error && <div className="alert alert-danger">{error}</div>}
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<div className="modal-header"> <div className="m-3 d-flex justify-content-center">
<h5 className="modal-title" id="loginModalLabel"> <Link to="/">
회원가입 <img src="/BORA.png" style={{ width: '160px' }} />
</h5> </Link>
<button
type="button"
className="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div> </div>
<div className="modal-body"> <div className="row mt-4">
<h5 style={{ textAlign: 'center' }}>회원가입</h5>
</div>
<div className="form-group">
<div className="p-2"> <div className="p-2">
<label className="p-1">이름</label> <label className="p-1">이름</label>
<input <input
...@@ -90,38 +90,6 @@ const Signup = () => { ...@@ -90,38 +90,6 @@ const Signup = () => {
onChange={handleChange} onChange={handleChange}
/> />
</div> </div>
<div className="p-2">
<label className="p-1">주민등록번호</label>
<div className="d-flex text-center">
<div className="col-4">
<input
className="mt-2 form-control"
id="idNumber1"
type="text"
name="idNumber1"
placeholder="●●●●●●"
maxLength='6'
value={idNumber1}
onChange={handleChange}
/>
</div>
<div className="col-1 pt-3 ps-2"></div>
<div className="col-1">
<input
className="mt-2 ms-2 form-control"
id="idNumber2"
type="text"
style={{width:'35px'}}
name="idNumber2"
placeholder=""
value={idNumber2}
onChange={handleChange}
maxLength='1'
/>
</div>
<div className="pt-3 ps-4">* * * * * *</div>
</div>
</div>
<div className="p-2"> <div className="p-2">
<label className="p-1">아이디</label> <label className="p-1">아이디</label>
<input <input
...@@ -159,7 +127,7 @@ const Signup = () => { ...@@ -159,7 +127,7 @@ const Signup = () => {
/> />
</div> </div>
<div className="p-2"> <div className="p-2">
<label className="p-1">전화번호(선택)</label> <label className="p-1">전화번호</label>
<input <input
className="form-control" className="form-control"
id="phone" id="phone"
...@@ -170,15 +138,21 @@ const Signup = () => { ...@@ -170,15 +138,21 @@ const Signup = () => {
onChange={handleChange} onChange={handleChange}
/> />
</div> </div>
</div> {/* {console.log(disabled)} */}
<div className="modal-footer"> <div className="mt-3 d-flex justify-content-center">
<button type="submit" className="btn btn-primary" disabled={disabled}> <button
type="submit"
className="btn btn-primary"
onClick={handleSubmit}
disabled={disabled}
>
회원가입 회원가입
</button> </button>
</div> </div>
</div>
</form> </form>
</div> </div>
); )
}; }
export default Signup; export default Signup
import { Link } from "react-router-dom";
import Login from "../components/Login"; import Login from "../components/Login";
import SignUp from "../components/SignUp"; import SignUp from "../components/SignUp";
...@@ -6,44 +7,22 @@ const HomeGuestPage = () => { ...@@ -6,44 +7,22 @@ const HomeGuestPage = () => {
<div className="d-flex flex-column justify-content-center h-100 font-weight-bold"> <div className="d-flex flex-column justify-content-center h-100 font-weight-bold">
<img src="BORA.PNG" className="w-100 p-4" /> <img src="BORA.PNG" className="w-100 p-4" />
<div className="d-flex flex-column align-items-center"> <div className="d-flex flex-column align-items-center">
<Link to="/login">
<button <button
type="button" type="button"
className="col-4 btn btn-info" className="row-4 btn btn-info"
data-bs-toggle="modal"
data-bs-target="#loginModal"
> >
로그인 로그인
</button> </button>
<div </Link>
className="modal fade" <Link to="/signup">
id="loginModal"
tabIndex="-1"
aria-labelledby="loginModalLabel"
aria-hidden="true"
>
<div className="modal-dialog">
<Login />
</div>
</div>
<button <button
type="button" type="button"
className="col-4 btn btn-info" className="row-4 btn btn-info"
data-bs-toggle="modal"
data-bs-target="#signupModal"
> >
회원가입 회원가입
</button> </button>
</div> </Link>
<div
className="modal fade"
id="signupModal"
tabIndex="-1"
aria-labelledby="signupModalLabel"
aria-hidden="true"
>
<div className="modal-dialog">
<SignUp />
</div>
</div> </div>
</div> </div>
); );
......
...@@ -10,7 +10,7 @@ const InvitePage = () => { ...@@ -10,7 +10,7 @@ const InvitePage = () => {
function Invitereject() { function Invitereject() {
// if () //초대받은 사람이 로그인 o // if () //초대받은 사람이 로그인 o
// <Link to="/user"></Link>//유저 페이지로 이동. // <Link to="/user/:id"></Link>//유저 페이지로 이동.
// else //로그인x // else //로그인x
// <Link to="/"></Link> //메인화면으로 이동. // <Link to="/"></Link> //메인화면으로 이동.
} }
......
$primary: #e8b7ff; $primary: #f5cfe3;
$secondary: #df99ff; $secondary: #df99ff;
$info: #fcf4ff; $info: #fcf4ff;
$warning: #ff0000; $warning: #ff0000;
......
...@@ -105,9 +105,9 @@ ...@@ -105,9 +105,9 @@
browserslist "^4.14.5" browserslist "^4.14.5"
semver "^5.5.0" semver "^5.5.0"
"@babel/helper-create-class-features-plugin@^7.12.1", "@babel/helper-create-class-features-plugin@^7.12.13", "@babel/helper-create-class-features-plugin@^7.12.17": "@babel/helper-create-className-features-plugin@^7.12.1", "@babel/helper-create-className-features-plugin@^7.12.13", "@babel/helper-create-className-features-plugin@^7.12.17":
version "7.12.17" version "7.12.17"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.17.tgz#704b69c8a78d03fb1c5fcc2e7b593f8a65628944" resolved "https://registry.yarnpkg.com/@babel/helper-create-className-features-plugin/-/helper-create-className-features-plugin-7.12.17.tgz#704b69c8a78d03fb1c5fcc2e7b593f8a65628944"
integrity sha512-I/nurmTxIxHV0M+rIpfQBF1oN342+yvl2kwZUrQuOClMamHF1w5tknfZubgNOLRoA73SzBFAdFcpb4M9HwOeWQ== integrity sha512-I/nurmTxIxHV0M+rIpfQBF1oN342+yvl2kwZUrQuOClMamHF1w5tknfZubgNOLRoA73SzBFAdFcpb4M9HwOeWQ==
dependencies: dependencies:
"@babel/helper-function-name" "^7.12.13" "@babel/helper-function-name" "^7.12.13"
...@@ -287,20 +287,20 @@ ...@@ -287,20 +287,20 @@
"@babel/helper-remap-async-to-generator" "^7.12.13" "@babel/helper-remap-async-to-generator" "^7.12.13"
"@babel/plugin-syntax-async-generators" "^7.8.0" "@babel/plugin-syntax-async-generators" "^7.8.0"
"@babel/plugin-proposal-class-properties@7.12.1": "@babel/plugin-proposal-className-properties@7.12.1":
version "7.12.1" version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz#a082ff541f2a29a4821065b8add9346c0c16e5de" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-className-properties/-/plugin-proposal-className-properties-7.12.1.tgz#a082ff541f2a29a4821065b8add9346c0c16e5de"
integrity sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w== integrity sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w==
dependencies: dependencies:
"@babel/helper-create-class-features-plugin" "^7.12.1" "@babel/helper-create-className-features-plugin" "^7.12.1"
"@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-proposal-class-properties@^7.12.1", "@babel/plugin-proposal-class-properties@^7.12.13": "@babel/plugin-proposal-className-properties@^7.12.1", "@babel/plugin-proposal-className-properties@^7.12.13":
version "7.12.13" version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.13.tgz#3d2ce350367058033c93c098e348161d6dc0d8c8" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-className-properties/-/plugin-proposal-className-properties-7.12.13.tgz#3d2ce350367058033c93c098e348161d6dc0d8c8"
integrity sha512-8SCJ0Ddrpwv4T7Gwb33EmW1V9PY5lggTO+A8WjyIwxrSHDUyBw4MtF96ifn1n8H806YlxbVCoKXbbmzD6RD+cA== integrity sha512-8SCJ0Ddrpwv4T7Gwb33EmW1V9PY5lggTO+A8WjyIwxrSHDUyBw4MtF96ifn1n8H806YlxbVCoKXbbmzD6RD+cA==
dependencies: dependencies:
"@babel/helper-create-class-features-plugin" "^7.12.13" "@babel/helper-create-className-features-plugin" "^7.12.13"
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-proposal-decorators@7.12.1": "@babel/plugin-proposal-decorators@7.12.1":
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.12.1.tgz#59271439fed4145456c41067450543aee332d15f" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.12.1.tgz#59271439fed4145456c41067450543aee332d15f"
integrity sha512-knNIuusychgYN8fGJHONL0RbFxLGawhXOJNLBk75TniTsZZeA+wdkDuv6wp4lGwzQEKjZi6/WYtnb3udNPmQmQ== integrity sha512-knNIuusychgYN8fGJHONL0RbFxLGawhXOJNLBk75TniTsZZeA+wdkDuv6wp4lGwzQEKjZi6/WYtnb3udNPmQmQ==
dependencies: dependencies:
"@babel/helper-create-class-features-plugin" "^7.12.1" "@babel/helper-create-className-features-plugin" "^7.12.1"
"@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-syntax-decorators" "^7.12.1" "@babel/plugin-syntax-decorators" "^7.12.1"
...@@ -416,7 +416,7 @@ ...@@ -416,7 +416,7 @@
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.13.tgz#ea78a12554d784ecf7fc55950b752d469d9c4a71" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.13.tgz#ea78a12554d784ecf7fc55950b752d469d9c4a71"
integrity sha512-sV0V57uUwpauixvR7s2o75LmwJI6JECwm5oPUY5beZB1nBl2i37hc7CJGqB5G+58fur5Y6ugvl3LRONk5x34rg== integrity sha512-sV0V57uUwpauixvR7s2o75LmwJI6JECwm5oPUY5beZB1nBl2i37hc7CJGqB5G+58fur5Y6ugvl3LRONk5x34rg==
dependencies: dependencies:
"@babel/helper-create-class-features-plugin" "^7.12.13" "@babel/helper-create-className-features-plugin" "^7.12.13"
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-proposal-unicode-property-regex@^7.12.1", "@babel/plugin-proposal-unicode-property-regex@^7.12.13", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": "@babel/plugin-proposal-unicode-property-regex@^7.12.1", "@babel/plugin-proposal-unicode-property-regex@^7.12.13", "@babel/plugin-proposal-unicode-property-regex@^7.4.4":
...@@ -441,9 +441,9 @@ ...@@ -441,9 +441,9 @@
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.8.0" "@babel/helper-plugin-utils" "^7.8.0"
"@babel/plugin-syntax-class-properties@^7.12.1", "@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3": "@babel/plugin-syntax-className-properties@^7.12.1", "@babel/plugin-syntax-className-properties@^7.12.13", "@babel/plugin-syntax-className-properties@^7.8.3":
version "7.12.13" version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-className-properties/-/plugin-syntax-className-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10"
integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
...@@ -583,9 +583,9 @@ ...@@ -583,9 +583,9 @@
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-transform-classes@^7.12.1", "@babel/plugin-transform-classes@^7.12.13": "@babel/plugin-transform-classNamees@^7.12.1", "@babel/plugin-transform-classNamees@^7.12.13":
version "7.12.13" version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.13.tgz#9728edc1838b5d62fc93ad830bd523b1fcb0e1f6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classNamees/-/plugin-transform-classNamees-7.12.13.tgz#9728edc1838b5d62fc93ad830bd523b1fcb0e1f6"
integrity sha512-cqZlMlhCC1rVnxE5ZGMtIb896ijL90xppMiuWXcwcOAuFczynpd3KYemb91XFFPi3wJSe/OcrX9lXoowatkkxA== integrity sha512-cqZlMlhCC1rVnxE5ZGMtIb896ijL90xppMiuWXcwcOAuFczynpd3KYemb91XFFPi3wJSe/OcrX9lXoowatkkxA==
dependencies: dependencies:
"@babel/helper-annotate-as-pure" "^7.12.13" "@babel/helper-annotate-as-pure" "^7.12.13"
...@@ -870,7 +870,7 @@ ...@@ -870,7 +870,7 @@
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.17.tgz#4aa6a5041888dd2e5d316ec39212b0cf855211bb" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.17.tgz#4aa6a5041888dd2e5d316ec39212b0cf855211bb"
integrity sha512-1bIYwnhRoetxkFonuZRtDZPFEjl1l5r+3ITkxLC3mlMaFja+GQFo94b/WHEPjqWLU9Bc+W4oFZbvCGe9eYMu1g== integrity sha512-1bIYwnhRoetxkFonuZRtDZPFEjl1l5r+3ITkxLC3mlMaFja+GQFo94b/WHEPjqWLU9Bc+W4oFZbvCGe9eYMu1g==
dependencies: dependencies:
"@babel/helper-create-class-features-plugin" "^7.12.17" "@babel/helper-create-className-features-plugin" "^7.12.17"
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
"@babel/plugin-syntax-typescript" "^7.12.13" "@babel/plugin-syntax-typescript" "^7.12.13"
...@@ -900,7 +900,7 @@ ...@@ -900,7 +900,7 @@
"@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4"
"@babel/helper-validator-option" "^7.12.1" "@babel/helper-validator-option" "^7.12.1"
"@babel/plugin-proposal-async-generator-functions" "^7.12.1" "@babel/plugin-proposal-async-generator-functions" "^7.12.1"
"@babel/plugin-proposal-class-properties" "^7.12.1" "@babel/plugin-proposal-className-properties" "^7.12.1"
"@babel/plugin-proposal-dynamic-import" "^7.12.1" "@babel/plugin-proposal-dynamic-import" "^7.12.1"
"@babel/plugin-proposal-export-namespace-from" "^7.12.1" "@babel/plugin-proposal-export-namespace-from" "^7.12.1"
"@babel/plugin-proposal-json-strings" "^7.12.1" "@babel/plugin-proposal-json-strings" "^7.12.1"
...@@ -913,7 +913,7 @@ ...@@ -913,7 +913,7 @@
"@babel/plugin-proposal-private-methods" "^7.12.1" "@babel/plugin-proposal-private-methods" "^7.12.1"
"@babel/plugin-proposal-unicode-property-regex" "^7.12.1" "@babel/plugin-proposal-unicode-property-regex" "^7.12.1"
"@babel/plugin-syntax-async-generators" "^7.8.0" "@babel/plugin-syntax-async-generators" "^7.8.0"
"@babel/plugin-syntax-class-properties" "^7.12.1" "@babel/plugin-syntax-className-properties" "^7.12.1"
"@babel/plugin-syntax-dynamic-import" "^7.8.0" "@babel/plugin-syntax-dynamic-import" "^7.8.0"
"@babel/plugin-syntax-export-namespace-from" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3"
"@babel/plugin-syntax-json-strings" "^7.8.0" "@babel/plugin-syntax-json-strings" "^7.8.0"
...@@ -928,7 +928,7 @@ ...@@ -928,7 +928,7 @@
"@babel/plugin-transform-async-to-generator" "^7.12.1" "@babel/plugin-transform-async-to-generator" "^7.12.1"
"@babel/plugin-transform-block-scoped-functions" "^7.12.1" "@babel/plugin-transform-block-scoped-functions" "^7.12.1"
"@babel/plugin-transform-block-scoping" "^7.12.1" "@babel/plugin-transform-block-scoping" "^7.12.1"
"@babel/plugin-transform-classes" "^7.12.1" "@babel/plugin-transform-classNamees" "^7.12.1"
"@babel/plugin-transform-computed-properties" "^7.12.1" "@babel/plugin-transform-computed-properties" "^7.12.1"
"@babel/plugin-transform-destructuring" "^7.12.1" "@babel/plugin-transform-destructuring" "^7.12.1"
"@babel/plugin-transform-dotall-regex" "^7.12.1" "@babel/plugin-transform-dotall-regex" "^7.12.1"
...@@ -972,7 +972,7 @@ ...@@ -972,7 +972,7 @@
"@babel/helper-plugin-utils" "^7.12.13" "@babel/helper-plugin-utils" "^7.12.13"
"@babel/helper-validator-option" "^7.12.17" "@babel/helper-validator-option" "^7.12.17"
"@babel/plugin-proposal-async-generator-functions" "^7.12.13" "@babel/plugin-proposal-async-generator-functions" "^7.12.13"
"@babel/plugin-proposal-class-properties" "^7.12.13" "@babel/plugin-proposal-className-properties" "^7.12.13"
"@babel/plugin-proposal-dynamic-import" "^7.12.17" "@babel/plugin-proposal-dynamic-import" "^7.12.17"
"@babel/plugin-proposal-export-namespace-from" "^7.12.13" "@babel/plugin-proposal-export-namespace-from" "^7.12.13"
"@babel/plugin-proposal-json-strings" "^7.12.13" "@babel/plugin-proposal-json-strings" "^7.12.13"
...@@ -985,7 +985,7 @@ ...@@ -985,7 +985,7 @@
"@babel/plugin-proposal-private-methods" "^7.12.13" "@babel/plugin-proposal-private-methods" "^7.12.13"
"@babel/plugin-proposal-unicode-property-regex" "^7.12.13" "@babel/plugin-proposal-unicode-property-regex" "^7.12.13"
"@babel/plugin-syntax-async-generators" "^7.8.0" "@babel/plugin-syntax-async-generators" "^7.8.0"
"@babel/plugin-syntax-class-properties" "^7.12.13" "@babel/plugin-syntax-className-properties" "^7.12.13"
"@babel/plugin-syntax-dynamic-import" "^7.8.0" "@babel/plugin-syntax-dynamic-import" "^7.8.0"
"@babel/plugin-syntax-export-namespace-from" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3"
"@babel/plugin-syntax-json-strings" "^7.8.0" "@babel/plugin-syntax-json-strings" "^7.8.0"
...@@ -1000,7 +1000,7 @@ ...@@ -1000,7 +1000,7 @@
"@babel/plugin-transform-async-to-generator" "^7.12.13" "@babel/plugin-transform-async-to-generator" "^7.12.13"
"@babel/plugin-transform-block-scoped-functions" "^7.12.13" "@babel/plugin-transform-block-scoped-functions" "^7.12.13"
"@babel/plugin-transform-block-scoping" "^7.12.13" "@babel/plugin-transform-block-scoping" "^7.12.13"
"@babel/plugin-transform-classes" "^7.12.13" "@babel/plugin-transform-classNamees" "^7.12.13"
"@babel/plugin-transform-computed-properties" "^7.12.13" "@babel/plugin-transform-computed-properties" "^7.12.13"
"@babel/plugin-transform-destructuring" "^7.12.13" "@babel/plugin-transform-destructuring" "^7.12.13"
"@babel/plugin-transform-dotall-regex" "^7.12.13" "@babel/plugin-transform-dotall-regex" "^7.12.13"
...@@ -2610,7 +2610,7 @@ babel-preset-current-node-syntax@^1.0.0: ...@@ -2610,7 +2610,7 @@ babel-preset-current-node-syntax@^1.0.0:
dependencies: dependencies:
"@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-async-generators" "^7.8.4"
"@babel/plugin-syntax-bigint" "^7.8.3" "@babel/plugin-syntax-bigint" "^7.8.3"
"@babel/plugin-syntax-class-properties" "^7.8.3" "@babel/plugin-syntax-className-properties" "^7.8.3"
"@babel/plugin-syntax-import-meta" "^7.8.3" "@babel/plugin-syntax-import-meta" "^7.8.3"
"@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-syntax-json-strings" "^7.8.3"
"@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3"
...@@ -2635,7 +2635,7 @@ babel-preset-react-app@^10.0.0: ...@@ -2635,7 +2635,7 @@ babel-preset-react-app@^10.0.0:
integrity sha512-itL2z8v16khpuKutx5IH8UdCdSTuzrOhRFTEdIhveZ2i1iBKDrVE0ATa4sFVy+02GLucZNVBWtoarXBy0Msdpg== integrity sha512-itL2z8v16khpuKutx5IH8UdCdSTuzrOhRFTEdIhveZ2i1iBKDrVE0ATa4sFVy+02GLucZNVBWtoarXBy0Msdpg==
dependencies: dependencies:
"@babel/core" "7.12.3" "@babel/core" "7.12.3"
"@babel/plugin-proposal-class-properties" "7.12.1" "@babel/plugin-proposal-className-properties" "7.12.1"
"@babel/plugin-proposal-decorators" "7.12.1" "@babel/plugin-proposal-decorators" "7.12.1"
"@babel/plugin-proposal-nullish-coalescing-operator" "7.12.1" "@babel/plugin-proposal-nullish-coalescing-operator" "7.12.1"
"@babel/plugin-proposal-numeric-separator" "7.12.1" "@babel/plugin-proposal-numeric-separator" "7.12.1"
...@@ -2679,7 +2679,7 @@ base@^0.11.1: ...@@ -2679,7 +2679,7 @@ base@^0.11.1:
integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==
dependencies: dependencies:
cache-base "^1.0.1" cache-base "^1.0.1"
class-utils "^0.3.5" className-utils "^0.3.5"
component-emitter "^1.2.1" component-emitter "^1.2.1"
define-property "^1.0.0" define-property "^1.0.0"
isobject "^3.0.1" isobject "^3.0.1"
...@@ -3205,9 +3205,9 @@ cjs-module-lexer@^0.6.0: ...@@ -3205,9 +3205,9 @@ cjs-module-lexer@^0.6.0:
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f"
integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw== integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw==
class-utils@^0.3.5: className-utils@^0.3.5:
version "0.3.6" version "0.3.6"
resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" resolved "https://registry.yarnpkg.com/className-utils/-/className-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"
integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==
dependencies: dependencies:
arr-union "^3.1.0" arr-union "^3.1.0"
...@@ -4716,7 +4716,7 @@ expand-brackets@^2.1.4: ...@@ -4716,7 +4716,7 @@ expand-brackets@^2.1.4:
debug "^2.3.3" debug "^2.3.3"
define-property "^0.2.5" define-property "^0.2.5"
extend-shallow "^2.0.1" extend-shallow "^2.0.1"
posix-character-classes "^0.1.0" posix-character-classNamees "^0.1.0"
regex-not "^1.0.0" regex-not "^1.0.0"
snapdragon "^0.8.1" snapdragon "^0.8.1"
to-regex "^3.0.1" to-regex "^3.0.1"
...@@ -7991,9 +7991,9 @@ portfinder@^1.0.26: ...@@ -7991,9 +7991,9 @@ portfinder@^1.0.26:
debug "^3.1.1" debug "^3.1.1"
mkdirp "^0.5.5" mkdirp "^0.5.5"
posix-character-classes@^0.1.0: posix-character-classNamees@^0.1.0:
version "0.1.1" version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" resolved "https://registry.yarnpkg.com/posix-character-classNamees/-/posix-character-classNamees-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
postcss-attribute-case-insensitive@^4.0.1: postcss-attribute-case-insensitive@^4.0.1:
...@@ -8104,9 +8104,9 @@ postcss-custom-selectors@^5.1.2: ...@@ -8104,9 +8104,9 @@ postcss-custom-selectors@^5.1.2:
postcss "^7.0.2" postcss "^7.0.2"
postcss-selector-parser "^5.0.0-rc.3" postcss-selector-parser "^5.0.0-rc.3"
postcss-dir-pseudo-class@^5.0.0: postcss-dir-pseudo-className@^5.0.0:
version "5.0.0" version "5.0.0"
resolved "https://registry.yarnpkg.com/postcss-dir-pseudo-class/-/postcss-dir-pseudo-class-5.0.0.tgz#6e3a4177d0edb3abcc85fdb6fbb1c26dabaeaba2" resolved "https://registry.yarnpkg.com/postcss-dir-pseudo-className/-/postcss-dir-pseudo-className-5.0.0.tgz#6e3a4177d0edb3abcc85fdb6fbb1c26dabaeaba2"
integrity sha512-3pm4oq8HYWMZePJY+5ANriPs3P07q+LW6FAdTlkFH2XqDdP4HeeJYMOzn0HYLhRSjBO3fhiqSwwU9xEULSrPgw== integrity sha512-3pm4oq8HYWMZePJY+5ANriPs3P07q+LW6FAdTlkFH2XqDdP4HeeJYMOzn0HYLhRSjBO3fhiqSwwU9xEULSrPgw==
dependencies: dependencies:
postcss "^7.0.2" postcss "^7.0.2"
...@@ -8495,7 +8495,7 @@ postcss-preset-env@6.7.0: ...@@ -8495,7 +8495,7 @@ postcss-preset-env@6.7.0:
postcss-custom-media "^7.0.8" postcss-custom-media "^7.0.8"
postcss-custom-properties "^8.0.11" postcss-custom-properties "^8.0.11"
postcss-custom-selectors "^5.1.2" postcss-custom-selectors "^5.1.2"
postcss-dir-pseudo-class "^5.0.0" postcss-dir-pseudo-className "^5.0.0"
postcss-double-position-gradients "^1.0.0" postcss-double-position-gradients "^1.0.0"
postcss-env-function "^2.0.2" postcss-env-function "^2.0.2"
postcss-focus-visible "^4.0.0" postcss-focus-visible "^4.0.0"
...@@ -8511,14 +8511,14 @@ postcss-preset-env@6.7.0: ...@@ -8511,14 +8511,14 @@ postcss-preset-env@6.7.0:
postcss-overflow-shorthand "^2.0.0" postcss-overflow-shorthand "^2.0.0"
postcss-page-break "^2.0.0" postcss-page-break "^2.0.0"
postcss-place "^4.0.1" postcss-place "^4.0.1"
postcss-pseudo-class-any-link "^6.0.0" postcss-pseudo-className-any-link "^6.0.0"
postcss-replace-overflow-wrap "^3.0.0" postcss-replace-overflow-wrap "^3.0.0"
postcss-selector-matches "^4.0.0" postcss-selector-matches "^4.0.0"
postcss-selector-not "^4.0.0" postcss-selector-not "^4.0.0"
postcss-pseudo-class-any-link@^6.0.0: postcss-pseudo-className-any-link@^6.0.0:
version "6.0.0" version "6.0.0"
resolved "https://registry.yarnpkg.com/postcss-pseudo-class-any-link/-/postcss-pseudo-class-any-link-6.0.0.tgz#2ed3eed393b3702879dec4a87032b210daeb04d1" resolved "https://registry.yarnpkg.com/postcss-pseudo-className-any-link/-/postcss-pseudo-className-any-link-6.0.0.tgz#2ed3eed393b3702879dec4a87032b210daeb04d1"
integrity sha512-lgXW9sYJdLqtmw23otOzrtbDXofUdfYzNm4PIpNE322/swES3VU9XlXHeJS46zT2onFO7V1QFdD4Q9LiZj8mew== integrity sha512-lgXW9sYJdLqtmw23otOzrtbDXofUdfYzNm4PIpNE322/swES3VU9XlXHeJS46zT2onFO7V1QFdD4Q9LiZj8mew==
dependencies: dependencies:
postcss "^7.0.2" postcss "^7.0.2"
......
import { Room, User } from "../models/index.js"; import { Room, User } from "../models/index.js";
import { customAlphabet } from 'nanoid' import { customAlphabet } from "nanoid";
import isLength from 'validator/lib/isLength.js' import isLength from "validator/lib/isLength.js";
import RoomModel from "../models/room.model.js";
const nanoid = customAlphabet('1234567890abcdef', 10) const nanoid = customAlphabet("1234567890abcdef", 10);
const joinRoom = async (req, res) => { const joinRoom = async (req, res) => {
const { userId, roomId } = req.body const { userId, roomId } = req.body;
const room_Id = await Room.findOne({ where: { id: roomId } }); const room_Id = await Room.findOne({ where: { id: roomId } });
if (Boolean(room_Id)) { //roomId에 일치하는 방이 존재할때 if (Boolean(room_Id)) {
//roomId에 일치하는 방이 존재할때
//roomId에 일치하는 방의 member정보에 userId 저장하기 //roomId에 일치하는 방의 member정보에 userId 저장하기
//member정보에 userId가 이미 저장되어 있는지 확인 -> 이미 참여된 방인지 확인 //member정보에 userId가 이미 저장되어 있는지 확인 -> 이미 참여된 방인지 확인
const includeUserId = room_Id.member.includes(parseInt(userId)); const includeUserId = room_Id.member.includes(parseInt(userId));
// console.log('Include확인:',includeUserId) // console.log('Include확인:',includeUserId)
if (!includeUserId) { //아직 참여되지 않은 방인경우 if (!includeUserId) {
room_Id.member.push(userId) //member에 userId추가 //아직 참여되지 않은 방인경우
room_Id.member.push(userId); //member에 userId추가
// console.log('room_Id.member2:', room_Id.member) // console.log('room_Id.member2:', room_Id.member)
await Room.update({ 'member': room_Id.member }, { where: { id: roomId } }) await Room.update({ member: room_Id.member }, { where: { id: roomId } });
//userId에 일치하는 사용자의 roomNumber에 roomId저장하기 //userId에 일치하는 사용자의 roomNumber에 roomId저장하기
const user_Id = await User.findOne({ where: { id: userId } }); const user_Id = await User.findOne({ where: { id: userId } });
if (Boolean(user_Id.roomNumber)) { //다른 roomNumber가 이미 들어가 있는 경우 roomId추가 if (Boolean(user_Id.roomNumber)) {
user_Id.roomNumber.push(roomId) //다른 roomNumber가 이미 들어가 있는 경우 roomId추가
} user_Id.roomNumber.push(roomId);
else { //첫 roomNumber인 경우 } else {
user_Id.roomNumber = [roomId] //첫 roomNumber인 경우
user_Id.roomNumber = [roomId];
} }
// console.log('user_Id.roomNumber2:', user_Id.roomNumber) // console.log('user_Id.roomNumber2:', user_Id.roomNumber)
await User.update({ 'roomNumber': user_Id.roomNumber }, { where: { id: userId } }) await User.update(
{ roomNumber: user_Id.roomNumber },
{ where: { id: userId } }
);
} else { } else {
return res.status(422).send('이미 참여된 방입니다.') return res.status(422).send("이미 참여된 방입니다.");
} }
} else { } else {
return res.status(422).send('참여코드와 일치하는 방이 존재하지 않습니다.') return res.status(422).send("참여코드와 일치하는 방이 존재하지 않습니다.");
} }
}; };
const multer = require("multer");
const upLoadRoomImg = multer({ dest: "roomUploads/" });
const roomImgUpload = upLoadRoomImg.fields([{ name: "profileimg", maxCount: 1 }]);
const createRoom = async (req, res) => { const createRoom = async (req, res) => {
// console.log('룸정보', req.body) const { userId, name } = req.body;
const { name, owner, member, profileimg } = req.body; const avatar = req.files["profileimg"][0];
const img = avatar.filename;
const id = nanoid() const id = nanoid()
const Id = await Room.findOne({ where: { id: id } }); const Id = await Room.findOne({ where: { id: id } });
// console.log('id:', id) // console.log('id:', id)
while (Boolean(Id)) { while (Id) {
const id = nanoid() const id = nanoid()
const Id = await Room.findOne({ where: { id: id } }); const Id = await Room.findOne({ where: { id: id } });
} }
try { try {
if (!isLength(name, { min: 3, max: 20 })) { if (!isLength(name, { min: 3, max: 20 })) {
return res.status(422).send('방이름은 3-20자여야 합니다.') return res.status(422).send("방이름은 3-20자여야 합니다.");
} }
//새로운 RoomDB생성 //새로운 RoomDB생성
const newRoom = { const newRoom = {
id: id, id: id,
name: name, name: name,
owner: owner, owner: userId,
member: [member], member: [userId],
profileimg: profileimg, profileimg: img,
} }
// console.log('newRoom:', newRoom) // console.log('newRoom:', newRoom)
await Room.create(newRoom) await Room.create(newRoom);
//user.roomNumber에 id추가 //user.roomNumber에 id추가
const user_Id = await User.findOne({ where: { id: owner } }); const user_Id = await User.findOne({ where: { id: userId } });
if (Boolean(user_Id.roomNumber)) { //다른 roomNumber가 이미 들어가 있는 경우 id추가 if (user_Id.roomNumber) { //다른 roomNumber가 이미 들어가 있는 경우 id추가
user_Id.roomNumber.push(id) user_Id.roomNumber.push(id)
} }
else { //첫 roomNumber인 경우 else { //첫 roomNumber인 경우
user_Id.roomNumber = [id] user_Id.roomNumber = [id]
} }
// console.log('user_Id.roomNumber2:', user_Id.roomNumber) // console.log('user_Id.roomNumber2:', user_Id.roomNumber)
await User.update({ 'roomNumber': user_Id.roomNumber }, { where: { id: owner } }) await User.update({ 'roomNumber': user_Id.roomNumber }, { where: { id: userId } })
res.json(newRoom) res.json(newRoom)
} catch (error) { } catch (error) {
console.log(error) console.log(error);
res.status(500).send('방생성 에러') res.status(500).send("방생성 에러");
} }
} };
const getRoom = async (req, res) => {
console.log("fhgfghdgfdgf:", req.body);
const roomId = req.body
try {
const roomlist = await Room.findAll({ where: { id: roomId } });
console.log(roomlist);
res.json(roomlist)
} catch (error) {
console.log(error);
res.status(500).send("에러");
}
};
const getRoom = async (req, res) => { const getRoom = async (req, res) => {
console.log('req.body:', req.body) console.log('req.body:', req.body)
} }
export default { export default {
joinRoom, createRoom, getRoom joinRoom, roomImgUpload, createRoom, getRoom
}; };
...@@ -70,7 +70,7 @@ const login = async (req, res) => { ...@@ -70,7 +70,7 @@ const login = async (req, res) => {
const signup = async (req, res) => { const signup = async (req, res) => {
try { try {
// console.log('sign up= ', req.body) console.log('sign up= ', req.body)
const { name, email, password, gender, phone } = req.body const { name, email, password, gender, phone } = req.body
const id = Math.floor(Math.random() * (9999 - 1000) + 1000) const id = Math.floor(Math.random() * (9999 - 1000) + 1000)
// console.log('id:', id) // console.log('id:', id)
...@@ -85,8 +85,8 @@ const signup = async (req, res) => { ...@@ -85,8 +85,8 @@ const signup = async (req, res) => {
if (user) if (user)
return res.status(422).send(`${email} 이미 존재하는 사용자입니다.`); return res.status(422).send(`${email} 이미 존재하는 사용자입니다.`);
if (!isLength(name, { min: 3, max: 10 })) { if (!isLength(name, { min: 2, max: 10 })) {
return res.status(422).send("이름은 3-10자 사이입니다"); return res.status(422).send("이름은 2-10자 사이입니다");
} else if (!isLength(password, { min: 6 })) { } else if (!isLength(password, { min: 6 })) {
return res.status(422).send("비밀번호는 6자이상 입니다"); return res.status(422).send("비밀번호는 6자이상 입니다");
} else if (!isLength(email, { min: 3, max: 10 })) { } else if (!isLength(email, { min: 3, max: 10 })) {
...@@ -97,7 +97,6 @@ const signup = async (req, res) => { ...@@ -97,7 +97,6 @@ const signup = async (req, res) => {
name: name, name: name,
email: email, email: email,
password: password, password: password,
gender: gender,
phone: phone, phone: phone,
}) })
} catch (error) { } catch (error) {
......
...@@ -28,7 +28,7 @@ sequelize ...@@ -28,7 +28,7 @@ sequelize
name: "room", name: "room",
owner: 8888, owner: 8888,
member: [8888,9999], member: [8888,9999],
profileimg: "C:\fakepath\스크린샷(1).png", profileimg: "ef0930f6be18ce73380d952337a6de1f",
}); });
await Room.create({ await Room.create({
...@@ -36,7 +36,7 @@ sequelize ...@@ -36,7 +36,7 @@ sequelize
name: "room1", name: "room1",
owner: 9999, owner: 9999,
member: [9999], member: [9999],
profileimg: "C:\fakepath\스크린샷(1).png", profileimg: "ef0930f6be18ce73380d952337a6de1f",
}); });
app.listen(appConfig.port, () => { app.listen(appConfig.port, () => {
......
...@@ -20,7 +20,7 @@ const RoomModel = (sequelize) => { ...@@ -20,7 +20,7 @@ const RoomModel = (sequelize) => {
}, },
profileimg: { profileimg: {
type: DataTypes.STRING, type: DataTypes.STRING,
defaultValue: "/user.png" defaultValue: "defaultimg"
}, },
channel: { channel: {
type: DataTypes.ARRAY(DataTypes.JSON), type: DataTypes.ARRAY(DataTypes.JSON),
......
...@@ -19,8 +19,8 @@ const UserModel = (sequelize) => { ...@@ -19,8 +19,8 @@ const UserModel = (sequelize) => {
password: { password: {
type: DataTypes.STRING, type: DataTypes.STRING,
}, },
gender: { checkpw:{
type: DataTypes.INTEGER, type: DataTypes.STRING,
}, },
phone: { phone: {
type: DataTypes.STRING, type: DataTypes.STRING,
......
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
"dev": "nodemon", "dev": "nodemon",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"nodemonConfig": {
"ignore": [
"test/*",
"docs/*",
"client/*"
]
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://compmath.korea.ac.kr/gitlab/research/bora_it.git" "url": "https://compmath.korea.ac.kr/gitlab/research/bora_it.git"
...@@ -26,7 +33,7 @@ ...@@ -26,7 +33,7 @@
"http": "0.0.1-security", "http": "0.0.1-security",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"multer": "^1.4.2", "multer": "^1.4.2",
"nanoid": "^3.1.20", "nanoid": "^3.1.23",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",
"pg": "^8.6.0", "pg": "^8.6.0",
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
......
...@@ -3,7 +3,7 @@ import roomCrtl from "../controllers/room.controller.js"; ...@@ -3,7 +3,7 @@ import roomCrtl from "../controllers/room.controller.js";
const router = express.Router(); const router = express.Router();
router.route("/getRoom").post(roomCrtl.getRoom); router.route("/getRoom").post(roomCrtl.getRoom);
router.route("/create").post(roomCrtl.createRoom); router.route("/create").post(roomCrtl.roomImgUpload, roomCrtl.createRoom);
router.route("/join").put(roomCrtl.joinRoom); router.route("/join").put(roomCrtl.joinRoom);
export default router; export default router;
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