diff --git a/README.md b/README.md index cb78858..61788aa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EventMaster -The most hackable Web Shop! +The most hackable Ticket-Shop! ## How to use @@ -47,424 +47,3 @@ The frontend runs on `http://localhost:5173/` and the backend on `http://localho ### Database ![database-erm](misc/images/database.png) - - -### Backend API endpoints - -The application host it's data in a SQLite database. The access is managed by an [ExpressJs](https://expressjs.com/) server which offers many REST-API endpoints for the frontend. The REST-API server runs on port 3000. - ---- - -#### 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) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | `cityName` | optional | string | Name of the city to filter for | -> | `genreName` | optional | string | Name of the genre to filter for | -> | `nrOfItems` | optional | number | Limits number of results | -> | `sortDirection` | optional | string | Sort by number of concerts, 'asc' or 'desc' | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array + Band & Genre>` | -
- - -
-GET /locations?count=nrOfItems&sort=sortDirection (Get all locations) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | `nrOfItems` | optional | number | Limits number of results | -> | `sortDirection` | optional | string | Sort by number of concerts, 'asc' or 'desc' | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array>` | -
- - -Down here: todo! - - - - -
-GET /bands (Get all bands) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array` | -
- - - -
-GET /bands/:id (Get all information about one band) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | `id` | required | string | ID of product in the database | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Band` + `Array` + `Array` | -
- - - -
-GET /shows/:id (Get all information about one show) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | `id` | required | string | ID of product in the database | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Show` + `Tour` + `Location` + `City` | -
- - - -
-GET /tours (Get all tours) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array` + `Band` + `Show` + `Location` + `City` | -
- - -
-GET /genres (Get all genres) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array` | -
- - - - - - - -
-GET /orders/:id (Get all orders of an user) - - -##### Parameters -> | name | type | data type | description | -> | --- | --- | --- | --- | -> | `id` | required | string | ID of userAccount in the database | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `ProductModel` + `Order`, `OrderItem`, `Product` | -
- - - -
-GET /categories/ (Get all Categories) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array` | -
- - - -
-GET /brands (Get all Brands) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `Array` | -
- - ---- - - -#### Creating new - -
-POST /accounts/ (Create a new account) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | None | required | object (JSON) | Model of an Account | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `201` | `application/json` | `AccountModel` | -> | `400` | `application/json` | `{code: 400, message: "Username too short!"}` | -> | `400` | `application/json` | `{code: 400, message: "Password too short!"}` | -> | `409` | `application/json` | `{code: 409, message: "Username already in use"}` | -
- - -
-POST /orders/ (Create a new order) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | None | required | object (JSON) | Model of an Order | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `201` | `application/json` | `OrderModel` | -
- ---- - -#### Updating existing - -
-PATCH /accounts/ (Update data of an existing account) - - -##### Parameters -> | name | type | data type | description | -> | :---: | --- | --- | --- | -> | None | required | object (JSON) | Model of an Account | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | AccountModel | -> | `400` | `application/json` | `{code: 400, message: "..."}` | -
- ---- - -#### Delete existing - - - ---- - -#### Miscs - -
-GET /api/ (Check if server runs) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | None | None | -
- -
-GET /resetDatabase/ (Reset the database to it's default values) - - -##### Parameters -> None - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | None | None | -
- - -#### Validate - -
-POST /accounts/login (Login for user) - -##### Parameters -> | name | type | data type | description | -> | --- | --- | --- | --- | -> | username | required | string | Username of the account | -> | password | required | string | Password of the account | - -##### Responses -> | http code | content-type | response | -> | :---: | --- | --- | -> | `200` | `application/json` | `AccountObject` + `Addresses`, `Payments`, `AccountRole` | -> | `400` | `application/json` | `{code: 400, message: "Bad Request"}` | -> | `401` | `application/json` | `{code: 401, message: "Unauthorized"}` | -
- ---- \ No newline at end of file