Skip to content

Commit

Permalink
Manually merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Gianpaolo Macario <[email protected]>
  • Loading branch information
gmacario committed Aug 9, 2021
2 parents 1cd62e1 + 733cfe9 commit 1978820
Show file tree
Hide file tree
Showing 8 changed files with 2,709 additions and 93 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
# RUN ls -laR
RUN npm install --silent
COPY . .
RUN npm run build
RUN npm run build:server
# RUN ls -la
# RUN ls -laR dist/
CMD ["node", "dist/app.js"]
CMD ["npm", "run", "serve:prod"]
# -----------------------------------------------------------------
#
# EOF
14 changes: 14 additions & 0 deletions client/src/lib/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import axios from 'axios'

const apiPath = '/api/author'

function getAuthors () {
axios.get(`${apiPath}`)
.then((res) => {
return (res.data)
})
}

export default {
getAuthors
}
14 changes: 5 additions & 9 deletions client/src/routes/authors.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@
var authors = [];
var addAuthorForm = {
id: "",
_id: "",
name: "",
bio: "",
};
var editForm = {
_id: "",
title: "",
author: "",
description: "",
};
let addopen = false;
let updateopen = false;
Expand Down Expand Up @@ -72,9 +67,10 @@
})
.catch((error) => {
console.error(error);
alert(error);
getAuthors();
});
closeDialog();
})
.finally(() => closeDialog());
}
function updateAuthor() {
Expand Down
139 changes: 134 additions & 5 deletions client/src/routes/books.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
<script>
import axios from 'axios'
import { onMount } from 'svelte';
import {
Button,
ButtonGroup,
Col,
Row,
Modal,
ModalBody,
ModalFooter,
ModalHeader,
Input,
Label,
Table,
} from "sveltestrap";
const apiPath = "/api/book"
const apiPath = "/api/book";
var books = []
var books = [];
var addBookForm = {
_id: "",
title: "",
authors: [],
owner: "",
genres: []
};
let addopen = false;
let updateopen = false;
function getBooks() {
axios.get(`${apiPath}`)
Expand All @@ -14,19 +37,85 @@
}
function deleteBook(book) {
const path = `${apiPath}/${book.id}`;
axios.delete(path)
const path = `${apiPath}/${book._id}`;
axios
.delete(path)
.then(() => {
getBooks();
})
.catch((error) => {
console.error(error);
getBooks();
});
};
function editBook(book) {
addBookForm._id = book._id;
addBookForm.title = book.title;
addBookForm.authors = book.authors;
addBookForm.owner = book.owner;
addBookForm.genres = book.genres;
updateopen = true;
addtoggle();
}
function addBook() {
const path = `${apiPath}`;
const payload = {
_id: addBookForm._id,
title: addBookForm.title,
authors: addBookForm.authors,
owner: addBookForm.owner,
genres: addBookForm.genres
};
axios
.post(path, payload)
.then(() => {
getBooks();
})
.catch((error) => {
console.error(error);
alert(error);
getBooks();
})
.finally(() => closeDialog());
}
function updateBook() {
const path = `${apiPath}/${addBookForm._id}`;
const payload = {
name: addBookForm.name,
authors: addBookForm.authors,
owner: addBookForm.owner,
genres: addBookForm.genres
};
axios
.put(path, payload)
.then(() => {
getBooks();
})
.catch((error) => {
console.error(error);
alert(error);
getBooks();
})
.finally(() => closeDialog());
}
function addtoggle() {
// initForm();
addopen = !addopen;
}
function closeDialog() {
addBookForm._id = "";
addBookForm.name = "";
addBookForm.authors = [];
addBookForm.owner = "";
addBookForm.genres = [];
addopen = false;
updateopen = false;
}
onMount(getBooks)
Expand All @@ -38,7 +127,7 @@
</svelte:head>

<h1>Books inside this ugly collection</h1>

<Button color="success" on:click={addtoggle}>Add Book</Button>
<div class="flex flex-col">
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
Expand Down Expand Up @@ -95,3 +184,43 @@
</div>
</div>
</div>
<Modal isOpen={addopen} {addtoggle}>
<ModalHeader {addtoggle}
>{#if updateopen}Edit Book{:else}Add a new Book{/if}</ModalHeader
>
<ModalBody>
<Label for="newTitle">Title:</Label>
<Input
type="text"
bind:value={addBookForm.title}
placeholder="book title"
/>
<p />
<Label for="newAuthor">Author:</Label>
<Input
type="text"
bind:value={addBookForm.authors}
placeholder="author name"
/>
<p />
<Label for="newAuthor">Author:</Label>
<Input
type="text"
bind:value={addBookForm.owner}
placeholder="owner"
/>
<Input
type="text"
bind:value={addBookForm.genres}
placeholder="genres"
/>
</ModalBody>
<ModalFooter>
{#if updateopen}
<Button color="primary" on:click={updateBook}>Update Book</Button>
{:else}
<Button color="primary" on:click={addBook}>Add Book</Button>
{/if}
<Button color="secondary" on:click={closeDialog}>Cancel</Button>
</ModalFooter>
</Modal>
8 changes: 4 additions & 4 deletions docs/rasic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

|Task|gmacario|Raffone17|GGn0|alv67|gteti|
|--------------|-|-|-|-|-|
|DB structure |I| |R|S|S|
|DB structure |I|A|R|S|S|
|Dev.frontend |A|S|I|R|I|
|Dev.backend |I|R| |S|I|
|Ops |R| | |I|I|
|Deploy |R| | |I|I|
|Dev.backend |I|R|-|S|I|
|Ops |S|I|I|I|R|
|Deploy |R|I|I|I|I|
|Documentation |R|I|S|S|S|

## Explanation
Expand Down
91 changes: 91 additions & 0 deletions docs/redeem-you-hackathon-prize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Redeem your prize for completing the MongoDB Hackathon

<!-- 2021-07-23 02:24 CEST-->

## Mail received from DigitalOcean

> From: Chris Sev <[email protected]><br>
> Date: Fri, Jul 23, 2:24 AM (2 days ago)<br>
> BCC: me<br>
> Subject: Congrats on Completing the MongoDB Hackathon!
>
> Hey hey! Chris Sev here.
>
> Congrats on completing the DigitalOcean + MongoDB Hackathon! It was a fun 3 weeks and you did it! You completed an app and deployed it for the world to see!
>
> As promised, your prize is a DigitalOcean shirt and sticker pack.
>
> 👉 Redeem Your Prize: <https://forms.gle/xxxx>
>
> Next up, I'll be putting together another email to showcase some of the awesome apps you all submitted.
>
> ---
>
> Chris Sev<br>
> Sr Developer Advocate<br>
> [email protected]
## 👉 Redeem Your Prize

<!-- 2021-07-25 09:39 CEST -->

Browse <https://forms.gle/xxxx>

> **Redeem Your Hackathon Prize 🎉**
>
> Congrats on completing the DigitalOcean + MongoDB hackathon!
> Great work and fantastic coding.
>
> Fill out the form below to redeem your shirt and sticker pack.
> Make sure to be thorough in your address so we can send to the correct spot.<br>
> * Required
>
> * Did you enjoy the hackathon? \*<br>
> Provide any feedback on the experience, the process, the product,
> or just how you felt through this hackathon.
>
> * Name \*
>
> * Email Address \*
>
> * Shirt Size \*
> - [ ] XS
> - [ ] S
> - [ ] M
> - [ ] L
> - [ ] XL
> - [ ] XXL
>
> * Address 1 \*
>
> * Address 2
>
> * City \*
>
> * State/Province/Region
>
> * Zip/Postal Code \*
>
> * Country \*
>
> [Submit]()
>
> Never submit passwords through Google Forms.
>
> This form was created inside of DigitalOcean. [Report Abuse]()
Fill in the form, then click "Submit".

> **Redeem Your Hackathon Prize 🎉**
>
> Thanks for participating in the DigitalOcean Hackathon.
> We will process these quickly and send your shirt and stickers.
> Please allow time for the shipment.
>
> [Edit your response]()
>
> This form was created inside of DigitalOcean. [Report Abuse]()
>
> [Google Forms](https://www.google.com/forms/about)
<!-- EOF -->
Loading

0 comments on commit 1978820

Please sign in to comment.