From b7291577b7b5b7113d0296c14e0997a5f3872b2c Mon Sep 17 00:00:00 2001 From: TobiZog Date: Mon, 11 Nov 2024 08:15:21 +0100 Subject: [PATCH] Documentation --- README.md | 112 ++++++++++++++++++ software/backend/routes/band.routes.ts | 14 +++ software/src/data/api/mainApi.ts | 20 ++++ .../src/pages/account/ordersPage/index.vue | 3 +- .../bandDetailPage/bandMemberSection.vue | 17 ++- .../bands/bandDetailPage/concertSection.vue | 24 ++-- .../bands/bandDetailPage/gallerySection.vue | 17 ++- .../src/pages/bands/bandDetailPage/index.vue | 40 +------ .../bands/bandDetailPage/ratingSection.vue | 7 ++ software/src/stores/order.store.ts | 8 +- software/src/stores/preferences.store.ts | 6 + 11 files changed, 198 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 871d5d9..b337824 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,118 @@ The application host it's data in a SQLite database. The access is managed by an #### Listing existing +
+GET /accounts/ (Get all Accounts) + + +##### Parameters +> None + +##### Responses +> | http code | content-type | response | +> | :---: | --- | --- | +> | `200` | `application/json` | `Array` | + +##### Example Response +```json +[ + { + "id": 421, + "username": "hagemeister93", + "password": "Xjt3qb5t", + "email": "hagemeister93@gmail.com", + "firstName": "Laurin", + "lastName": "Hagemeister", + "accountRoleId": 2, + "accountRole": { + "id": 2, + "name": "Admin", + "privilegeBuy": true, + "privilegeAdminPanel": true + } + } +] +``` + +
+ +
+GET /api/files (Get all public files) + + +##### Parameters +> None + +##### Responses +> | http code | content-type | response | +> | :---: | --- | --- | +> | `200` | `application/json` | `Array<{folder: String, files: Array<{name: String, size: Number, url: String}> }>` | + +##### Example Response +```json +[ + { + "folder": "artists", + "files": [ + { + "name": "alex-turner.jpg", + "size": 56473, + "url": "http://localhost:3000/static/artists/alex-turner.jpg" + }, + { + "name": "andy-nicholson.jpg", + "size": 68983, + "url": "http://localhost:3000/static/artists/andy-nicholson.jpg" + } + ] + } +] +``` +
+ +
+GET /bands/ (Get all bands) + + +##### Parameters +> | name | type | data type | description | +> | :---: | --- | --- | --- | +> | `sort` | optional | string | Sort by number of concerts ascending (asc) or descending (desc) | +> | `count` | optional | number | Number of items to responde | + +##### Responses +> | http code | content-type | response | +> | :---: | --- | --- | +> | `200` | `application/json` | `Array<>` | + +##### Example Response +```json +[ + { + "folder": "artists", + "files": [ + { + "name": "alex-turner.jpg", + "size": 56473, + "url": "http://localhost:3000/static/artists/alex-turner.jpg" + }, + { + "name": "andy-nicholson.jpg", + "size": 68983, + "url": "http://localhost:3000/static/artists/andy-nicholson.jpg" + } + ] + } +] +``` +
+ + + + + + +
GET /events?city=cityName&genre=genreName&count=nrOfItems&sort=sortDirection (Get all events, filtered by city and genre) diff --git a/software/backend/routes/band.routes.ts b/software/backend/routes/band.routes.ts index 6c0a322..83530b5 100644 --- a/software/backend/routes/band.routes.ts +++ b/software/backend/routes/band.routes.ts @@ -158,4 +158,18 @@ band.post("/", (req: Request, res: Response) => { .then(result => { res.status(200).json(result) }) +}) + +band.delete("/", (req: Request, res: Response) => { + Band.destroy({ + where: { + id: req.body.id + } + }) + .then(result => { + res.status(200).json(result) + }) + .catch(error => { + res.status(500).send() + }) }) \ No newline at end of file diff --git a/software/src/data/api/mainApi.ts b/software/src/data/api/mainApi.ts index dc07cc0..5cb89bb 100644 --- a/software/src/data/api/mainApi.ts +++ b/software/src/data/api/mainApi.ts @@ -2,18 +2,38 @@ import axios from "axios" const BASE_URL = "http://localhost:3000/api" +/** + * Fetch the current state of backend server + * + * @returns Response from server + */ export function fetchServerState() { return axios.get(BASE_URL) } +/** + * Reset the database (without exercise progress) to factory state + * + * @returns Response from server + */ export function resetDatabase() { return axios.get(BASE_URL + "/resetdatabase") } +/** + * Reset the exercise progress + * + * @returns Response from server + */ export function resetExerciseProgress() { return axios.get(BASE_URL + "/resetExerciseProgress") } +/** + * Fetch all static file names + * + * @returns Response from server + */ export function fetchFileNames() { return axios.get(BASE_URL + "/files") } \ No newline at end of file diff --git a/software/src/pages/account/ordersPage/index.vue b/software/src/pages/account/ordersPage/index.vue index 27be1dd..2468de0 100644 --- a/software/src/pages/account/ordersPage/index.vue +++ b/software/src/pages/account/ordersPage/index.vue @@ -8,7 +8,6 @@ import { useOrderStore } from '@/stores/order.store'; const accountStore = useAccountStore() const orderStore = useOrderStore() -accountStore.refreshOrders() orderStore.getOrdersOfAccount(accountStore.userAccount) @@ -16,7 +15,7 @@ orderStore.getOrdersOfAccount(accountStore.userAccount) diff --git a/software/src/pages/bands/bandDetailPage/bandMemberSection.vue b/software/src/pages/bands/bandDetailPage/bandMemberSection.vue index 7d5f6f7..76a2c3b 100644 --- a/software/src/pages/bands/bandDetailPage/bandMemberSection.vue +++ b/software/src/pages/bands/bandDetailPage/bandMemberSection.vue @@ -1,19 +1,18 @@