diff --git a/backend/routes/transaction.js b/backend/routes/transaction.js index c57c23c0ca733f174d2bd872c1032d8dfbb0210d..2e552986299b570876e32a09e87848252c1cd15b 100644 --- a/backend/routes/transaction.js +++ b/backend/routes/transaction.js @@ -32,7 +32,7 @@ router.post("/cancel", async (req, res) => { console.error(err); return; } - transaction.buyerId = ""; + transaction.buyerId = null; transaction.on_transaction = false; transaction.save(); res.json({ result: true }); @@ -43,7 +43,7 @@ router.post("/cancel", async (req, res) => { } }); -router.post("/success", async (req, res) => { +router.post("/end", async (req, res) => { console.log("POST - success start"); var sess = req.session; var req_bookTitle = req.body.bookTitle; @@ -68,8 +68,6 @@ router.post("/success", async (req, res) => { book.stock--; book.save(); }); - // transaction.on_transaction = ""; - // transaction.save(); res.json({ result: true }); } ); @@ -119,7 +117,7 @@ router.post("/sell", async (req, res) => { var transaction = new Transaction(); transaction.sellerId = sellerId; - transaction.buyerId = ""; + transaction.buyerId = null; transaction.bookTitle = book.title; transaction.on_transaction = false; book.stock++; diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 8c4c6352c6c2c854958ca3e4aa9a18ac6a59bcc1..a909dccb107441ced0ca147208abcabb94b36162 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,7 +1,7 @@ <template> <div id="app" class="page-container"> <md-app md-mode="fixed-last"> - <md-app-toolbar class="md-large md-dense md-primary"> + <md-app-toolbar class="md-dense md-primary"> <div class="md-toolbar-row"> <span class="md-title">MajorBook</span> </div> @@ -15,7 +15,6 @@ <Logout /> </div> </div> - <div class="md-toolbar-row"> <md-tabs class="md-primary" style="margin: auto; height: 30px"> <md-tab id="tab-home" md-label="Home" to="/home"></md-tab> @@ -67,15 +66,6 @@ export default { }); } } - // computed: { - // checkLoggedIn() { - // console.log(this.checkSession()); - // if (this.checkSession() === true) { - // return true; - // } - // return false; - // } - // } }; </script> diff --git a/frontend/src/components/BookSearchPage.vue b/frontend/src/components/BookSearchPage.vue index 2f2e00d598716ba59a2ddebddee09b8b9c7b4792..848dee4ba2ffc6a1f1a480e1517ec0abfe7d459c 100644 --- a/frontend/src/components/BookSearchPage.vue +++ b/frontend/src/components/BookSearchPage.vue @@ -120,8 +120,22 @@ export default { grade: null, major: null, type: null, - option1: ["1�숇뀈", "2�숇뀈", "3�숇뀈", "4�숇뀈","�꾪븰��"], - option2: ["�뚰봽�몄썾�댄븰怨�", "誘몃뵒�댄븰怨�", "寃쎌젣�숆낵","寃쎌쁺�숆낵","�섑븰怨�","�곗뾽怨듯븰怨�","�ы쉶�숆낵","�꾩옄怨듯븰怨�","湲곌퀎怨듯븰怨�","�좎냼�ш났�숆낵","�섍꼍�덉쟾怨듯븰怨�","�섑븰�꾧났","怨듯넻怨쇰ぉ"], + option1: ["1�숇뀈", "2�숇뀈", "3�숇뀈", "4�숇뀈", "�꾪븰��"], + option2: [ + "�뚰봽�몄썾�댄븰怨�", + "誘몃뵒�댄븰怨�", + "寃쎌젣�숆낵", + "寃쎌쁺�숆낵", + "�섑븰怨�", + "�곗뾽怨듯븰怨�", + "�ы쉶�숆낵", + "�꾩옄怨듯븰怨�", + "湲곌퀎怨듯븰怨�", + "�좎냼�ш났�숆낵", + "�섍꼍�덉쟾怨듯븰怨�", + "�섑븰�꾧났", + "怨듯넻怨쇰ぉ" + ], option3: ["�꾧났�꾩닔", "�꾧났�좏깮", "援먯뼇�좏깮", "湲곗큹怨쇰ぉ"], Books: [], submit: { diff --git a/frontend/src/components/Buy.vue b/frontend/src/components/Buy.vue index 9bfa8724c9563fd299719a27eb1997cbe0c5789d..804389dced78ef522579bdf41541f1ba74bf335f 100644 --- a/frontend/src/components/Buy.vue +++ b/frontend/src/components/Buy.vue @@ -34,9 +34,7 @@ <div class="md-title">�� 梨낆쓣 援щℓ�섏떆寃좎뒿�덇퉴?</div> </md-card-header> <md-card-actions> - <md-button class="md-raised md-primary" v-on:click="buyBook" - >援щℓ</md-button - > + <md-button class="md-raised md-primary" v-on:click="buyBook">援щℓ</md-button> </md-card-actions> </md-card> </div> diff --git a/frontend/src/components/Sell.vue b/frontend/src/components/Sell.vue index 4ef1e0c15e71d9ddf7787cfb8e8e3a9442a5a867..2a336be282e324a39448c912901c442bb4051f03 100644 --- a/frontend/src/components/Sell.vue +++ b/frontend/src/components/Sell.vue @@ -34,9 +34,7 @@ <div class="md-title">�� 梨낆쓣 �먮ℓ�섏떆寃좎뒿�덇퉴?</div> </md-card-header> <md-card-actions> - <md-button class="md-raised md-primary" v-on:click="sellBook" - >�먮ℓ</md-button - > + <md-button class="md-raised md-primary" v-on:click="sellBook">�먮ℓ</md-button> </md-card-actions> </md-card> </div> diff --git a/frontend/src/components/login/Login.vue b/frontend/src/components/login/Login.vue index 4fb93701d43fe026d0c89ca16956d6b91cac4f7f..2b6dfa807dfcc947ad65366d455185aca1e865f6 100644 --- a/frontend/src/components/login/Login.vue +++ b/frontend/src/components/login/Login.vue @@ -9,38 +9,19 @@ <md-field :class="getValidationClass('id')"> <label>ID</label> <md-input name="ID" id="ID" v-model="user.id" :disabled="sending" /> - <span class="md-error" v-if="!$v.user.id.required" - >The ID is required"</span - > - <span class="md-error" v-else-if="!$v.user.id.minlength" - >�꾩씠�붾뒗 �ㅼ꽢 �먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <span class="md-error" v-if="!$v.user.id.required">The ID is required"</span> + <span class="md-error" v-else-if="!$v.user.id.minlength">�꾩씠�붾뒗 �ㅼ꽢 �먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> <md-field :class="getValidationClass('password')"> <label>Password</label> - <md-input - v-model="user.password" - type="password" - :disabled="sending" - /> - <span class="md-error" v-if="!$v.user.password.required" - >The Password is required</span - > - <span class="md-error" v-else-if="!$v.user.password.minlength" - >鍮꾨�踰덊샇�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <md-input v-model="user.password" type="password" :disabled="sending" /> + <span class="md-error" v-if="!$v.user.password.required">The Password is required</span> + <span class="md-error" v-else-if="!$v.user.password.minlength">鍮꾨�踰덊샇�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> - <md-button - class="md-raised md-primary" - type="submit" - :disabled="sending" - >Login</md-button - > - <md-button class="md-primary" v-on:click="active = false" - >Close</md-button - > + <md-button class="md-raised md-primary" type="submit" :disabled="sending">Login</md-button> + <md-button class="md-primary" v-on:click="active = false">Close</md-button> </md-content> </form> </md-dialog> @@ -134,7 +115,10 @@ export default { }; </script> -<style> +<style scoped> +.md-primary { + margin: 0; +} .select { margin: 15px; display: inline-flex; diff --git a/frontend/src/components/login/SignUp.vue b/frontend/src/components/login/SignUp.vue index 99fdef738c63f6a0abbefbcba9aaf8b7e6a32255..b12ce0193037edca60aafd4a5125d9226a761461 100644 --- a/frontend/src/components/login/SignUp.vue +++ b/frontend/src/components/login/SignUp.vue @@ -8,84 +8,43 @@ <md-field :class="getValidationClass('name')"> <label>Name</label> <md-input name="name" v-model="user.name" :disabled="sending" /> - <span class="md-error" v-if="!$v.user.name.required" - >The Name is required"</span - > - <span class="md-error" v-else-if="!$v.user.name.minlength" - >�대쫫�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <span class="md-error" v-if="!$v.user.name.required">The Name is required"</span> + <span class="md-error" v-else-if="!$v.user.name.minlength">�대쫫�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> <md-field :class="getValidationClass('id')"> <label for="id">ID</label> <md-input name="id" v-model="user.id" :disabled="sending" /> - <span class="md-error" v-if="!$v.user.id.required" - >The ID is required"</span - > - <span class="md-error" v-else-if="!$v.user.id.minlength" - >�꾩씠�붾뒗 �ㅼ꽢 �먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <span class="md-error" v-if="!$v.user.id.required">The ID is required"</span> + <span class="md-error" v-else-if="!$v.user.id.minlength">�꾩씠�붾뒗 �ㅼ꽢 �먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> - <md-field - :md-toggle-password="true" - :class="getValidationClass('password')" - > + <md-field :md-toggle-password="true" :class="getValidationClass('password')"> <label for="password">Password</label> - <md-input - name="password" - v-model="user.password" - type="password" - :disabled="sending" - /> - <span class="md-error" v-if="!$v.user.password.required" - >The Password is required</span - > - <span class="md-error" v-else-if="!$v.user.password.minlength" - >鍮꾨�踰덊샇�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <md-input name="password" v-model="user.password" type="password" :disabled="sending" /> + <span class="md-error" v-if="!$v.user.password.required">The Password is required</span> + <span class="md-error" v-else-if="!$v.user.password.minlength">鍮꾨�踰덊샇�� �� �먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> <md-field :class="getValidationClass('email')"> <label for="email">Email</label> - <md-input - name="email" - type="email" - v-model="user.email" - :disabled="sending" - /> - <span class="md-error" v-if="!$v.user.email.required" - >The email is required</span - > - <span class="md-error" v-else-if="!$v.user.email.email" - >Invalid email</span - > + <md-input name="email" type="email" v-model="user.email" :disabled="sending" /> + <span class="md-error" v-if="!$v.user.email.required">The email is required</span> + <span class="md-error" v-else-if="!$v.user.email.email">Invalid email</span> </md-field> <md-field :class="getValidationClass('phonenumber')"> <label for="phonenumber">Phone Number</label> - <md-input - name="phonenumber" - v-model="user.phonenumber" - :disabled="sending" - /> - <span class="md-error" v-if="!$v.user.phonenumber.required" - >The Phone Number is required</span - > - <span class="md-error" v-else-if="!$v.user.phonenumber.minlength" - >�대��� 踰덊샇�� 10�먮━ �댁긽�댁뼱�� �⑸땲��.</span - > + <md-input name="phonenumber" v-model="user.phonenumber" :disabled="sending" /> + <span class="md-error" v-if="!$v.user.phonenumber.required">The Phone Number is required</span> + <span + class="md-error" + v-else-if="!$v.user.phonenumber.minlength" + >�대��� 踰덊샇�� 10�먮━ �댁긽�댁뼱�� �⑸땲��.</span> </md-field> - <md-button - class="md-raised md-primary" - type="submit" - :disabled="sending" - >Sign Up</md-button - > - <md-button class="md-primary" v-on:click="active = false" - >Close</md-button - > + <md-button class="md-raised md-primary" type="submit" :disabled="sending">Sign Up</md-button> + <md-button class="md-primary" v-on:click="active = false">Close</md-button> </md-content> </form> </md-dialog> @@ -93,6 +52,9 @@ </template> <style scoped> +.md-primary { + margin: 0; +} .select { margin: 15px; display: inline-flex; diff --git a/frontend/src/components/profilecomponent/buylist.vue b/frontend/src/components/profilecomponent/buylist.vue index 9f3af357a07f8128896da76f9cfb5ce20b961142..141c5a5b2b884af417924134ac04463103cf0119 100644 --- a/frontend/src/components/profilecomponent/buylist.vue +++ b/frontend/src/components/profilecomponent/buylist.vue @@ -7,12 +7,9 @@ <md-list-item v-for="transaction in transactions" :key="transaction._id" - v-if="transaction.buyerId == userId" + v-if="transaction.buyerId == userId && transaction.buyerId != null" > - <md-button - class="md-icon-button md-raised" - style="color:#1DDB16;backgroundColor:#1DDB16" - > + <md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16"> <img src="../../assets/book-open-flat.png" /> </md-button> <div class="md-list-item-text"> @@ -51,19 +48,10 @@ export default { transactions: [], userId: "" }), - computed: { - // buyerTransaction() { - v-for�� computed �덉벐硫� 肄붾뱶 鍮④컙�됰맖, �묐룞�� �� - // return this.transactions.filter(tran => { - // if(this.buyerId === this.userId) { - // return mov; - // } - // }) - // } - }, methods: { cancelTransaction(book_Title) { this.$http - .post("/api/transaction/success", { + .post("/api/transaction/cancel", { bookTitle: book_Title }) .then(response => { @@ -76,7 +64,7 @@ export default { }, successTransaction(book_Title) { this.$http - .post("/api/transaction/success", { + .post("/api/transaction/end", { bookTitle: book_Title }) .then(response => { diff --git a/frontend/src/components/profilecomponent/sellist.vue b/frontend/src/components/profilecomponent/sellist.vue index 1959577298c1df2e3c77ba8c4fc1df2792eb3ce5..846e2a507e8f41462b2cf07506ae6c93bf328c34 100644 --- a/frontend/src/components/profilecomponent/sellist.vue +++ b/frontend/src/components/profilecomponent/sellist.vue @@ -9,10 +9,7 @@ :key="transaction._id" v-if="transaction.sellerId == userId" > - <md-button - class="md-icon-button md-raised" - style="color:#1DDB16;backgroundColor:#1DDB16" - > + <md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16"> <img src="../../assets/book-open-flat.png" /> </md-button> <div class="md-list-item-text"> @@ -54,11 +51,11 @@ export default { methods: { cancelTransaction(book_Title) { this.$http - .post("/api/transaction/success", { + .post("/api/transaction/end", { bookTitle: book_Title }) .then(response => { - alert("嫄곕옒瑜� 痍⑥냼�섏��듬땲��."); + alert("�먮ℓ瑜� 痍⑥냼�섏��듬땲��."); location.reload(); }) .catch(error => { @@ -67,7 +64,7 @@ export default { }, successTransaction(book_Title) { this.$http - .post("/api/transaction/success", { + .post("/api/transaction/end", { bookTitle: book_Title }) .then(response => {