최정민

FEAT: 선호도 조사추가

-
...@@ -104,14 +104,21 @@ router.post("/login", (req, res) => { ...@@ -104,14 +104,21 @@ router.post("/login", (req, res) => {
104 req.session.user.nickname = req.body.nickname; 104 req.session.user.nickname = req.body.nickname;
105 req.session.user.age = req.body.age; 105 req.session.user.age = req.body.age;
106 req.session.user.gender = req.body.gender; 106 req.session.user.gender = req.body.gender;
107 + req.session.user.price=req.body.price;
108 + req.session.user.kindness=req.body.kindness;
109 + req.session.user.noise=req.body.noise;
110 + req.session.user.accessibility=req.body.accessibility;
107 var sql = 111 var sql =
108 - "INSERT INTO USER(EMAIL, NAME, NICKNAME, AGE, GENDER) VALUES(?,?,?,?,?)"; 112 + "INSERT INTO USER(EMAIL,NICKNAME, AGE, GENDER, PICTURE, KINDNESS, NOISE, ACCESSIBILITY) VALUES(?,?,?,?,?,?,?,?)";
109 var parameter = [ 113 var parameter = [
110 req.session.user.email, 114 req.session.user.email,
111 - req.session.user.name,
112 req.session.user.nickname, 115 req.session.user.nickname,
113 req.session.user.age, 116 req.session.user.age,
114 req.session.user.gender, 117 req.session.user.gender,
118 + req.session.user.price,
119 + req.session.user.kindness,
120 + req.session.user.noise,
121 + req.session.user.accessibility
115 ]; 122 ];
116 connection.query(sql, parameter, function (err) { 123 connection.query(sql, parameter, function (err) {
117 if (err) { 124 if (err) {
...@@ -134,7 +141,6 @@ function checkAuthenticated(req, res, next) { ...@@ -134,7 +141,6 @@ function checkAuthenticated(req, res, next) {
134 audience: CLIENT_ID, // Specify the CLIENT_ID of the app that accesses the backend 141 audience: CLIENT_ID, // Specify the CLIENT_ID of the app that accesses the backend
135 }); 142 });
136 const payload = ticket.getPayload(); 143 const payload = ticket.getPayload();
137 - user.name = payload.name;
138 user.email = payload.email; 144 user.email = payload.email;
139 user.picture = payload.picture; 145 user.picture = payload.picture;
140 } 146 }
......
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1622125471625,"user":{"name":"‍최정민[학생](소프트웨어융합대학 컴퓨터공학과)","email":"cjm2021401@khu.ac.kr","picture":"https://lh3.googleusercontent.com/a/AATXAJzFD3R6CaL2NpysVrfvdGqcQ83vh_wpbN_5hj-0=s96-c"}}
...\ No newline at end of file ...\ No newline at end of file
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1622135361726,"user":{"email":"cjm104174@gmail.com","picture":"https://lh3.googleusercontent.com/a-/AOh14Gh3nytGsPbviGhkznR8HIwrL6o7xBIoFL08nIeU=s96-c","nickname":"cjm","age":"19","gender":"male","price":"1","kindness":"2","noise":"3","accessibility":"4"}}
...\ No newline at end of file ...\ No newline at end of file
...@@ -64,13 +64,7 @@ ...@@ -64,13 +64,7 @@
64 64
65 <script> 65 <script>
66 function onSignIn(googleUser) { 66 function onSignIn(googleUser) {
67 - // var profile = googleUser.getBasicProfile();
68 - // console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
69 - // console.log('Name: ' + profile.getName());
70 - // console.log('Image URL: ' + profile.getImageUrl());
71 - // console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
72 var id_token = googleUser.getAuthResponse().id_token; 67 var id_token = googleUser.getAuthResponse().id_token;
73 - // console.log(id_token);
74 var xhr = new XMLHttpRequest(); 68 var xhr = new XMLHttpRequest();
75 xhr.open('POST', '/index'); 69 xhr.open('POST', '/index');
76 xhr.setRequestHeader('Content-Type', 'application/json'); 70 xhr.setRequestHeader('Content-Type', 'application/json');
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
64 <div class="row"> 64 <div class="row">
65 <div class="col-2"></div> 65 <div class="col-2"></div>
66 <div class="col-8"> 66 <div class="col-8">
67 - <hr class="my-4" style="background-color: white"> 67 + <hr class="my-2" style="background-color: white">
68 <form method="post"> 68 <form method="post">
69 <div class="form-group"> 69 <div class="form-group">
70 <label for="id_input">닉네임을 입력하세요</label> 70 <label for="id_input">닉네임을 입력하세요</label>
...@@ -84,8 +84,93 @@ ...@@ -84,8 +84,93 @@
84 <option value="male">Male</option> 84 <option value="male">Male</option>
85 <option value="female">Female</option> 85 <option value="female">Female</option>
86 </select> 86 </select>
87 + <hr class="my-3" style="background-color: white">
88 + <hr class="my-2" />
89 + <hr class="my-2" style="background-color: white">
90 + <div class="pricing-header px-3 py-1 pt-md-3 pb-md-1 mx-auto text-center">
91 + <h5 class="display- ">PREFERENCE</h5>
92 + <p>카페를 선택할 떄 중요하게 여기는 요소들의 순위를 매겨주세요.</p>
93 + <p>(순위가 중복되면 안됩니다. ex) 가격 1순위, 친절 1순위(X)</p>
94 + </div>
95 + <div class="text-center">
96 + <label for="price_form" class="form-label font-weight-bold" style="margin-right: 15px">가격</label>
97 + <div class="form-check form-check-inline" id="price_form">
98 + <input class="form-check-input" type="radio" name="price" id="price1" value="1">
99 + <label class="form-check-label" for="price1">1순위</label>
100 + </div>
101 + <div class="form-check form-check-inline">
102 + <input class="form-check-input" type="radio" name="price" id="price2" value="2">
103 + <label class="form-check-label" for="price2">2순위</label>
104 + </div>
105 + <div class="form-check form-check-inline">
106 + <input class="form-check-input" type="radio" name="price" id="price3" value="3" >
107 + <label class="form-check-label" for="price3">3순위</label>
108 + </div>
109 + <div class="form-check form-check-inline">
110 + <input class="form-check-input" type="radio" name="price" id="price4" value="4" >
111 + <label class="form-check-label" for="price4">4순위</label>
112 + </div>
113 + <hr class="my-1" style="background-color: white" />
114 +
115 + <label for="kindness_form" class="form-label font-weight-bold" style="margin-right: 5px">친절도</label>
116 + <div class="form-check form-check-inline" id="kindness_form">
117 + <input class="form-check-input" type="radio" name="kindness" id="kindness1" value="1">
118 + <label class="form-check-label" for="kindness">1순위</label>
119 + </div>
120 + <div class="form-check form-check-inline">
121 + <input class="form-check-input" type="radio" name="kindness" id="kindness2" value="2">
122 + <label class="form-check-label" for="kindness2">2순위</label>
123 + </div>
124 + <div class="form-check form-check-inline">
125 + <input class="form-check-input" type="radio" name="kindness" id="kindness3" value="3" >
126 + <label class="form-check-label" for="kindness3">3순위</label>
127 + </div>
128 + <div class="form-check form-check-inline">
129 + <input class="form-check-input" type="radio" name="kindness" id="kindness4" value="4" >
130 + <label class="form-check-label" for="kindness4">4순위</label>
131 + </div>
87 132
88 - <hr class="my-4" style="background-color: white" /> 133 + <hr class="my-1" style="background-color: white" />
134 +
135 + <label for="noise_form" class="form-label font-weight-bold" style="margin-right: 15px"></label>
136 + <div class="form-check form-check-inline" id="noise_form">
137 + <input class="form-check-input" type="radio" name="noise" id="noise1" value="1">
138 + <label class="form-check-label" for="noise">1순위</label>
139 + </div>
140 + <div class="form-check form-check-inline">
141 + <input class="form-check-input" type="radio" name="noise" id="noise2" value="2">
142 + <label class="form-check-label" for="kindness2">2순위</label>
143 + </div>
144 + <div class="form-check form-check-inline">
145 + <input class="form-check-input" type="radio" name="noise" id="noise3" value="3" >
146 + <label class="form-check-label" for="noise3">3순위</label>
147 + </div>
148 + <div class="form-check form-check-inline">
149 + <input class="form-check-input" type="radio" name="noise" id="noise4" value="4" >
150 + <label class="form-check-label" for="noise4">4순위</label>
151 + </div>
152 +
153 + <hr class="my-1" style="background-color: white" />
154 +
155 + <label for="accessibility_form" class="form-label font-weight-bold" style="margin-right: 5px">접근성</label>
156 + <div class="form-check form-check-inline" id="accessibility_form">
157 + <input class="form-check-input" type="radio" name="accessibility" id="accessibility1" value="1">
158 + <label class="form-check-label" for="accessibility">1순위</label>
159 + </div>
160 + <div class="form-check form-check-inline">
161 + <input class="form-check-input" type="radio" name="accessibility" id="accessibility2" value="2">
162 + <label class="form-check-label" for="accessibility2">2순위</label>
163 + </div>
164 + <div class="form-check form-check-inline">
165 + <input class="form-check-input" type="radio" name="accessibility" id="accessibility3" value="3" >
166 + <label class="form-check-label" for="accessibility3">3순위</label>
167 + </div>
168 + <div class="form-check form-check-inline">
169 + <input class="form-check-input" type="radio" name="accessibility" id="accessibility4" value="4" >
170 + <label class="form-check-label" for="accessibility4">4순위</label>
171 + </div>
172 + </div>
173 + <hr class="my-3" style="background-color: white" />
89 <button type="submit" style="float: right" class="btn btn-primary btn-lg" id="please">Submit</button> 174 <button type="submit" style="float: right" class="btn btn-primary btn-lg" id="please">Submit</button>
90 </form> 175 </form>
91 </div> 176 </div>
......
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
329 </div> 329 </div>
330 <div class="col-md-8"> 330 <div class="col-md-8">
331 <div class="card-body"> 331 <div class="card-body">
332 - <h5 class="card-title"><%=user.name%></h5> 332 + <h5 class="card-title"><%=user.nickname%></h5>
333 <p class="card-text"> 333 <p class="card-text">
334 Age : <%=user.age%>, Gender : <%=user.gender%> 334 Age : <%=user.age%>, Gender : <%=user.gender%>
335 </p> 335 </p>
......