WIP Functionality to request wines for next lottery #24

Merged
Adrianht merged 23 commits from feat/request-wine into master 2020-09-07 14:28:31 +00:00
3 changed files with 21 additions and 6 deletions
Showing only changes of commit 543a7a6eb3 - Show all commits

View File

@@ -22,7 +22,6 @@ router.route("/request").get(async (req, res) => {
router.route("/request").post(async (req, res) => {
const {wine} = req.body
console.log(wine)
let thisWineIsLOKO = await Wine.findOne({id: wine.id})
@@ -37,12 +36,10 @@ router.route("/request").post(async (req, res) => {
});
await thisWineIsLOKO.save()
}
console.log(thisWineIsLOKO)
let requestedWine = await RequestedWine.findOne({ "wineId": wine.id})
if(requestedWine == undefined){
// console.log(localWine)
requestedWine = new RequestedWine({
count: 1,
wineId: wine.id,

View File

@@ -27,7 +27,7 @@ const convertToOurWineObject = wine => {
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
router.route("/wineinfo/search").get(async (req, res) => {
const {query} = req.query
let url = new URL(`https://apis.vinmonopolet.no/products/v0/details-normal?productShortNameContains=test&maxResults=5`)
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
let url = new URL(`https://apis.vinmonopolet.no/products/v0/details-normal?productShortNameContains=test&maxResults=15`)
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
url.searchParams.set('productShortNameContains', query)
const vinmonopoletResponse = await fetch(url, {
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed

View File

@@ -26,7 +26,7 @@
</div>
</section>
<section class="buttons">
<button class="vin-button" @click="request(wine)">Send inn denne som ønske</button>
<button class="vin-button" @click="request(wine)">Foreslå denne</button>
<a
v-if="wine.vivinoLink"
:href="wine.vivinoLink"
@@ -78,7 +78,6 @@ export default {
fetch("http://localhost:30030/api/request", options)
.then(res => res.json())
.then(console.log)
}
},
}
@@ -155,6 +154,25 @@ input[type="text"] {
width: 40%;
margin-right: 1rem;
}
@include mobile {
display: flex;
flex-direction: column;
.wine-image {
height: 100px;
width: 50px;
align-self: center;
}
.buttons{
display: flex;
flex-direction: column;
align-self: center;
margin: 1em;
.wine-link{
margin-top: 1em;
}
}
}
}