Compare commits
2 Commits
v.0.2.0
...
6f6efa5886
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f6efa5886 | |||
| 4498c865f2 |
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Account
|
||||
* description: API to manage accounts
|
||||
*/
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Account } from "../models/user/account.model";
|
||||
import { validateString } from "../scripts/validateHelper";
|
||||
@@ -11,20 +17,38 @@ import { encryptString } from "../scripts/encryptScripts";
|
||||
|
||||
export const account = Router()
|
||||
|
||||
account.get("/", verifyToken, (req: Request, res: Response) => {
|
||||
Account.findAll({
|
||||
include: [ AccountRole ]
|
||||
})
|
||||
.then(accounts => {
|
||||
res.status(200).json(accounts)
|
||||
})
|
||||
.catch(error => {
|
||||
res.status(500).send()
|
||||
})
|
||||
})
|
||||
|
||||
// Login user
|
||||
account.get("/account/login", async (req: Request, res: Response) => {
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/login:
|
||||
* get:
|
||||
* summary: Start login process
|
||||
* tags: [Account]
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: username
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Username
|
||||
* - in: query
|
||||
* name: password
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: User password
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Login successful
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/loginResponse'
|
||||
* 401:
|
||||
* description: Wrong credentials
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
account.get("/login", async (req: Request, res: Response) => {
|
||||
const encryptedPassword = encryptString(String(req.query.password))
|
||||
|
||||
try {
|
||||
@@ -47,10 +71,7 @@ account.get("/account/login", async (req: Request, res: Response) => {
|
||||
})
|
||||
} else {
|
||||
// Status: 401 Unauthorized
|
||||
res.status(401).json({
|
||||
code: 401,
|
||||
message: "Unauthorized"
|
||||
})
|
||||
res.status(401).send()
|
||||
}
|
||||
} catch (e) {
|
||||
res.status(500).send()
|
||||
@@ -58,12 +79,35 @@ account.get("/account/login", async (req: Request, res: Response) => {
|
||||
})
|
||||
|
||||
|
||||
account.get("/account/data", verifyToken, async(req: Request, res: Response) => {
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/account:
|
||||
* get:
|
||||
* summary: Get all data about an user account
|
||||
* tags: [Account]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/useraccount'
|
||||
* 401:
|
||||
* description: Unauthorized
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
account.get("/account", verifyToken, async(req: Request, res: Response) => {
|
||||
Account.findOne({
|
||||
where: {
|
||||
id: req["id"]
|
||||
},
|
||||
include: [ Address, AccountRole, Payment ]
|
||||
include: [ Address, AccountRole, Payment ],
|
||||
attributes: {
|
||||
exclude: [ "accountRoleId" ]
|
||||
}
|
||||
})
|
||||
.then(account => {
|
||||
res.status(200).json(account)
|
||||
@@ -74,7 +118,31 @@ account.get("/account/data", verifyToken, async(req: Request, res: Response) =>
|
||||
})
|
||||
|
||||
|
||||
// Creating a new user
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/account:
|
||||
* post:
|
||||
* summary: Create a new user account
|
||||
* tags: [Account]
|
||||
* requestBody:
|
||||
* description: Minimal user data body
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/minimalAccount'
|
||||
* responses:
|
||||
* 201:
|
||||
* description: Created
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/useraccount'
|
||||
* 400:
|
||||
* description: Username/password too short
|
||||
* 409:
|
||||
* description: Username already in use
|
||||
*/
|
||||
account.post("/account", async (req: Request, res: Response) => {
|
||||
// Check if username is valid
|
||||
if (!validateString(req.body.username, 4))
|
||||
@@ -121,6 +189,28 @@ account.post("/account", async (req: Request, res: Response) => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/account:
|
||||
* patch:
|
||||
* summary: Update an user accounts data
|
||||
* tags: [Account]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/useraccount'
|
||||
* 401:
|
||||
* description: Unauthorized
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
account.patch("/account", verifyToken, (req: Request, res: Response) => {
|
||||
Account.update(req.body,
|
||||
{
|
||||
@@ -164,7 +254,31 @@ account.patch("/account", verifyToken, (req: Request, res: Response) => {
|
||||
})
|
||||
})
|
||||
|
||||
account.delete("/account/:id", (req: Request, res: Response) => {
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/account/{id}:
|
||||
* delete:
|
||||
* summary: Delete an user account
|
||||
* tags: [Account]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* schema:
|
||||
* type: number
|
||||
* required: true
|
||||
* description: ID of user account
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
* 401:
|
||||
* description: Unauthorized
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
account.delete("/account/:id", verifyToken, (req: Request, res: Response) => {
|
||||
Account.destroy({
|
||||
where: {
|
||||
id: req.params.id
|
||||
@@ -177,3 +291,36 @@ account.delete("/account/:id", (req: Request, res: Response) => {
|
||||
res.status(500).send()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /accounts/:
|
||||
* get:
|
||||
* summary: Request all user accounts
|
||||
* tags: [Account]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/useraccount'
|
||||
* 401:
|
||||
* description: Unauthorized
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
account.get("/", verifyToken, (req: Request, res: Response) => {
|
||||
Account.findAll({
|
||||
include: [ AccountRole ]
|
||||
})
|
||||
.then(accounts => {
|
||||
res.status(200).json(accounts)
|
||||
})
|
||||
.catch(error => {
|
||||
res.status(500).send()
|
||||
})
|
||||
})
|
||||
@@ -1,18 +1,38 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Api
|
||||
* description: Main API access point for misc events
|
||||
*/
|
||||
import { Request, Response, NextFunction, Router } from 'express'
|
||||
import { deleteAllTables, deleteExerciseProgressTables, prepopulateDatabase, prepopulateExerciseDatabase } from '../scripts/databaseHelper'
|
||||
|
||||
export const api = Router()
|
||||
|
||||
/**
|
||||
* Status check endpoint
|
||||
* @swagger
|
||||
* /api:
|
||||
* get:
|
||||
* summary: Status check endpoint
|
||||
* tags: [Api]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Server is up and running
|
||||
*/
|
||||
api.get("/", (req: Request, res: Response, next: NextFunction) => {
|
||||
res.status(200).send()
|
||||
})
|
||||
|
||||
/**
|
||||
* Reset the whole database to factory state
|
||||
* Doesn't effect ExerciseTable and ExerciseGroupTable
|
||||
* @swagger
|
||||
* /api/resetdatabase:
|
||||
* get:
|
||||
* summary: Reset the database to factory state
|
||||
* description: Doesn't effect ExerciseTable and ExerciseGroupTable
|
||||
* tags: [Api]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Reset successful
|
||||
*/
|
||||
api.get("/resetdatabase", async (req: Request, res: Response, next: NextFunction) => {
|
||||
// Step 1: Delete all data tables
|
||||
@@ -26,7 +46,15 @@ api.get("/resetdatabase", async (req: Request, res: Response, next: NextFunction
|
||||
})
|
||||
|
||||
/**
|
||||
* Reset ExerciseTable and ExerciseGroupTable to factory state
|
||||
* @swagger
|
||||
* /api/resetExerciseProgress:
|
||||
* get:
|
||||
* summary: Reset exercises to factory state
|
||||
* description: Reset ExerciseTable and ExerciseGroupTable to factory state
|
||||
* tags: [Api]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Reset successful
|
||||
*/
|
||||
api.get("/resetExerciseProgress", async (req: Request, res: Response, next: NextFunction) => {
|
||||
deleteExerciseProgressTables()
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Bands
|
||||
* description: API to manage the bands
|
||||
*/
|
||||
import { Member } from "../models/acts/member.model";
|
||||
import { Band } from "../models/acts/band.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
@@ -13,7 +19,33 @@ import { sequelize } from "../database";
|
||||
export const band = Router()
|
||||
|
||||
/**
|
||||
* Get all bands
|
||||
* @swagger
|
||||
* /bands:
|
||||
* get:
|
||||
* summary: Download all available bands
|
||||
* tags: [Bands]
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: sort
|
||||
* schema:
|
||||
* type: string
|
||||
* required: false
|
||||
* description: Sort bands by number of concerts ascending (asc) or descending (desc)
|
||||
* - in: query
|
||||
* name: count
|
||||
* schema:
|
||||
* type: number
|
||||
* required: false
|
||||
* description: Limit number of results
|
||||
* responses:
|
||||
* 200:
|
||||
* description: List of band objects
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/band'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
band.get("/", (req: Request, res: Response) => {
|
||||
let sort = req.query.sort
|
||||
@@ -71,7 +103,7 @@ band.get("/", (req: Request, res: Response) => {
|
||||
/**
|
||||
* Get all information about one band
|
||||
*/
|
||||
band.get("/band/:name", (req: Request, res: Response) => {
|
||||
band.get("/:name", (req: Request, res: Response) => {
|
||||
Band.findOne({
|
||||
where: {
|
||||
name: { [Op.like]: req.params.name }
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Cities
|
||||
* description: API to manage the cities
|
||||
*/
|
||||
import { City } from "../models/locations/city.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
|
||||
export const city = Router()
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /cities:
|
||||
* get:
|
||||
* summary: Download all cities
|
||||
* tags: [Cities]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: List of all cities as objects
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/city'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
city.get("/", (req: Request, res: Response) => {
|
||||
City.findAll()
|
||||
.then(cities => {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Concerts
|
||||
* description: API to manage the concerts
|
||||
*/
|
||||
import { Location } from "../models/locations/location.model";
|
||||
import { Concert } from "../models/acts/concert.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Exercises
|
||||
* description: API to manage the exercise progress
|
||||
*/
|
||||
import { Op } from "sequelize";
|
||||
import { Exercise } from "../models/exercises/exercise.model";
|
||||
import { ExerciseGroup } from "../models/exercises/exerciseGroup.model";
|
||||
@@ -6,11 +12,28 @@ import { Request, Response, Router } from "express";
|
||||
export const exercises = Router()
|
||||
|
||||
/**
|
||||
* Get all Exercises grouped in ExerciseGroups
|
||||
* @swagger
|
||||
* /exercises:
|
||||
* get:
|
||||
* summary: Download all exercises
|
||||
* tags: [Exercises]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Array of all exercises
|
||||
* type: array
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/exercise'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
exercises.get("/", (req: Request, res: Response) => {
|
||||
Exercise.findAll({
|
||||
include: [ ExerciseGroup ]
|
||||
include: [ ExerciseGroup ],
|
||||
attributes: {
|
||||
exclude: [ "exerciseGroupId" ]
|
||||
}
|
||||
})
|
||||
.then(result => {
|
||||
result.sort((a, b) => {
|
||||
@@ -25,11 +48,39 @@ exercises.get("/", (req: Request, res: Response) => {
|
||||
})
|
||||
|
||||
/**
|
||||
* Update state of an Exercise
|
||||
*
|
||||
* @param groupNr Number of exercise group (not ID)
|
||||
* @param exerciseNr Number of exercise (not ID)
|
||||
* @param state New state boolean
|
||||
* @swagger
|
||||
* /exercises/{groupNr}/{exerciseNr}/{state}:
|
||||
* post:
|
||||
* summary: Update an exercise solved state
|
||||
* tags: [Exercises]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: groupNr
|
||||
* schema:
|
||||
* type: number
|
||||
* required: true
|
||||
* description: Number of exercise group (not ID)
|
||||
* - in: path
|
||||
* name: exerciseNr
|
||||
* schema:
|
||||
* type: number
|
||||
* required: true
|
||||
* description: Number of exercise (not ID)
|
||||
* - in: path
|
||||
* name: state
|
||||
* schema:
|
||||
* type: number
|
||||
* required: true
|
||||
* description: 1 = Solved, 0 = Unsolved
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Edited exercise
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/exercise'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
exercises.post("/:groupNr/:exerciseNr/:state", (req: Request, res: Response) => {
|
||||
Exercise.findOne({
|
||||
@@ -43,7 +94,10 @@ exercises.post("/:groupNr/:exerciseNr/:state", (req: Request, res: Response) =>
|
||||
}
|
||||
]
|
||||
},
|
||||
include: [ ExerciseGroup ]
|
||||
include: [ ExerciseGroup ],
|
||||
attributes: {
|
||||
exclude: [ "exerciseGroupId" ]
|
||||
}
|
||||
})
|
||||
.then(async exercise => {
|
||||
let changed = false
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Files
|
||||
* description: API for handling static files
|
||||
*/
|
||||
import { Request, Response, NextFunction, Router } from 'express'
|
||||
import fs, { createReadStream } from "fs"
|
||||
import fs from "fs"
|
||||
import multer from "multer"
|
||||
const upload = multer({ dest: './backend/images/' })
|
||||
import licenses from "../data/licenses.json"
|
||||
@@ -8,7 +14,18 @@ import path from 'path'
|
||||
export const files = Router()
|
||||
|
||||
/**
|
||||
* Get all folders
|
||||
* @swagger
|
||||
* /files/folders:
|
||||
* get:
|
||||
* summary: Get all static folders
|
||||
* tags: [Files]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Login successful
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/folder'
|
||||
*/
|
||||
files.get("/folders", async (req: Request, res: Response) => {
|
||||
let dirNames = fs.readdirSync(path.resolve(__dirname, "../images"))
|
||||
@@ -26,9 +43,25 @@ files.get("/folders", async (req: Request, res: Response) => {
|
||||
|
||||
|
||||
/**
|
||||
* Get all uploaded file names by folder name
|
||||
*
|
||||
* @param folder Name of folder on server
|
||||
* @swagger
|
||||
* /files/{folder}:
|
||||
* get:
|
||||
* summary: Get all files in one folder
|
||||
* tags: [Files]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: folder
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Name of folder
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Login successful
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/file'
|
||||
*/
|
||||
files.get("/:folder", async (req: Request, res: Response) => {
|
||||
let result = []
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Genres
|
||||
* description: API to manage the music genres
|
||||
*/
|
||||
import { Band } from "../models/acts/band.model";
|
||||
import { Genre } from "../models/acts/genre.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
@@ -5,7 +11,20 @@ import { Request, Response, Router } from "express";
|
||||
export const genre = Router()
|
||||
|
||||
/**
|
||||
* Get all available Genres
|
||||
* @swagger
|
||||
* /genres:
|
||||
* get:
|
||||
* summary: Get all available genres
|
||||
* tags: [Genres]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/genre'
|
||||
* 500:
|
||||
* description: Internal Server Error
|
||||
*/
|
||||
genre.get("/", (req: Request, res: Response) => {
|
||||
Genre.findAll({
|
||||
@@ -19,8 +38,22 @@ genre.get("/", (req: Request, res: Response) => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Update a Genre entry
|
||||
* @swagger
|
||||
* /genres:
|
||||
* patch:
|
||||
* summary: Update the dataset of a genre
|
||||
* tags: [Genres]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/genre'
|
||||
* 500:
|
||||
* description: Internal Server Error
|
||||
*/
|
||||
genre.patch("/", (req: Request, res: Response) => {
|
||||
Genre.update(req.body, {
|
||||
@@ -36,8 +69,22 @@ genre.patch("/", (req: Request, res: Response) => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Genre entry
|
||||
* @swagger
|
||||
* /genres:
|
||||
* post:
|
||||
* summary: Add a new dataset of a genre
|
||||
* tags: [Genres]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/genre'
|
||||
* 500:
|
||||
* description: Internal Server Error
|
||||
*/
|
||||
genre.post("/", (req: Request, res: Response) => {
|
||||
Genre.create(req.body)
|
||||
@@ -49,8 +96,22 @@ genre.post("/", (req: Request, res: Response) => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Genre entry
|
||||
* @swagger
|
||||
* /genres:
|
||||
* delete:
|
||||
* summary: Delete the dataset of a genre
|
||||
* tags: [Genres]
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/genre'
|
||||
* 500:
|
||||
* description: Internal Server Error
|
||||
*/
|
||||
genre.delete("/", (req: Request, res: Response) => {
|
||||
Genre.destroy({
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Locations
|
||||
* description: API to manage the event locations
|
||||
*/
|
||||
import { Concert } from "../models/acts/concert.model";
|
||||
import { City } from "../models/locations/city.model";
|
||||
import { Location } from "../models/locations/location.model";
|
||||
@@ -10,24 +16,57 @@ import { Op } from "sequelize";
|
||||
|
||||
export const location = Router()
|
||||
|
||||
// Response include rules
|
||||
const locationStructure = [
|
||||
City,
|
||||
{
|
||||
model: Concert,
|
||||
include: [ Band ]
|
||||
},
|
||||
{
|
||||
model: SeatGroup,
|
||||
include: [
|
||||
{
|
||||
model: SeatRow,
|
||||
include: [ Seat ]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* Get all available Locations
|
||||
*
|
||||
* @query sort Sort results ascending (asc) or descending (desc)
|
||||
* @query count Limit number of results
|
||||
* @swagger
|
||||
* /locations:
|
||||
* get:
|
||||
* summary: Get all available locations
|
||||
* tags: [Locations]
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: sort
|
||||
* schema:
|
||||
* type: string
|
||||
* required: false
|
||||
* description: Sort locations by number of concerts ascending (asc) or descending (desc)
|
||||
* - in: query
|
||||
* name: count
|
||||
* schema:
|
||||
* type: number
|
||||
* required: false
|
||||
* description: Limit number of results
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/location'
|
||||
*/
|
||||
location.get("/", (req: Request, res: Response) => {
|
||||
let sort = req.query.sort
|
||||
let count = req.query.count
|
||||
|
||||
Location.findAll({
|
||||
include: [
|
||||
City,
|
||||
{
|
||||
model: Concert,
|
||||
include: [ Band ],
|
||||
}
|
||||
],
|
||||
include: locationStructure,
|
||||
attributes: {
|
||||
exclude: [ "cityId" ]
|
||||
}
|
||||
@@ -60,29 +99,32 @@ location.get("/", (req: Request, res: Response) => {
|
||||
|
||||
|
||||
/**
|
||||
* Get all data about a specific location
|
||||
*
|
||||
* @param urlName UrlName of the band (e.g. Red Hot Chili Peppers => red-hot-chili-peppers)
|
||||
* @swagger
|
||||
* /locations/{urlName}:
|
||||
* get:
|
||||
* summary: Download all available informations about a specific locations
|
||||
* tags: [Locations]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: urlName
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Url name of the location to request for
|
||||
* responses:
|
||||
* 200:
|
||||
* description: List of band objects
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/location'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
location.get("/location/:urlName", (req: Request, res: Response) => {
|
||||
Location.findOne({
|
||||
where: { urlName: req.params.urlName },
|
||||
include: [
|
||||
City,
|
||||
{
|
||||
model: Concert,
|
||||
include: [ Band ],
|
||||
},
|
||||
{
|
||||
model: SeatGroup,
|
||||
include: [
|
||||
{
|
||||
model: SeatRow,
|
||||
include: [ Seat ]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
include: locationStructure,
|
||||
attributes: {
|
||||
exclude: [ "cityId" ]
|
||||
}
|
||||
@@ -105,9 +147,27 @@ location.get("/location/:urlName", (req: Request, res: Response) => {
|
||||
|
||||
|
||||
/**
|
||||
* Search for Locations
|
||||
*
|
||||
* @query value Search term to look for
|
||||
* @swagger
|
||||
* /locations/search:
|
||||
* get:
|
||||
* summary: Search for locations
|
||||
* tags: [Locations]
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: value
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Search term
|
||||
* responses:
|
||||
* 200:
|
||||
* description: List of band objects
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/location'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
location.get("/search", (req: Request, res: Response) => {
|
||||
Location.findAll({
|
||||
@@ -128,7 +188,7 @@ location.get("/search", (req: Request, res: Response) => {
|
||||
}
|
||||
]
|
||||
},
|
||||
include: [ City, Concert ]
|
||||
include: locationStructure
|
||||
})
|
||||
.then(locations => {
|
||||
res.status(200).json(locations)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Orders
|
||||
* description: API to manage orders
|
||||
*/
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Order } from "../models/ordering/order.model";
|
||||
import { Concert } from "../models/acts/concert.model";
|
||||
@@ -15,8 +21,34 @@ import { Account } from "../models/user/account.model";
|
||||
|
||||
export const order = Router()
|
||||
|
||||
// Get all orders
|
||||
/**
|
||||
* @swagger
|
||||
* /orders:
|
||||
* get:
|
||||
* summary: Get orders of an account or all available
|
||||
* tags: [Orders]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: id
|
||||
* schema:
|
||||
* type: string
|
||||
* required: false
|
||||
* description: User account id to filter the orders
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/order'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
order.get("/", verifyToken, (req: Request, res: Response) => {
|
||||
const accountId = req.query.id
|
||||
|
||||
Order.findAll({
|
||||
include: [
|
||||
{
|
||||
@@ -47,69 +79,58 @@ order.get("/", verifyToken, (req: Request, res: Response) => {
|
||||
},
|
||||
Address,
|
||||
Payment,
|
||||
Account
|
||||
]
|
||||
Account,
|
||||
],
|
||||
attributes: {
|
||||
exclude: [ "accountId", "addressId", "paymentId" ]
|
||||
}
|
||||
})
|
||||
.then(orders => {
|
||||
res.status(200).json(orders)
|
||||
if (accountId != undefined) {
|
||||
let filteredOrders = orders.filter(order => {
|
||||
return order.id == accountId
|
||||
})
|
||||
|
||||
res.status(200).json(filteredOrders)
|
||||
} else {
|
||||
res.status(200).json(orders)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
res.status(500).send()
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /orders:
|
||||
* post:
|
||||
* summary: Place a new order
|
||||
* tags: [Orders]
|
||||
* security:
|
||||
* - JWT: []
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: id
|
||||
* schema:
|
||||
* type: string
|
||||
* required: false
|
||||
* description: User account id to filter the orders
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/order'
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
order.post("/", verifyToken, (req: Request, res: Response) => {
|
||||
req.body["accountId"] = req["id"]
|
||||
|
||||
// Get all orders of one account by it's user id
|
||||
order.get("/:id", (req: Request, res: Response) => {
|
||||
Order.findAll({
|
||||
where: { accountId: req.params.id },
|
||||
include: [
|
||||
{
|
||||
model: Ticket,
|
||||
include: [
|
||||
{
|
||||
model: Concert,
|
||||
include: [
|
||||
{
|
||||
model: Band
|
||||
},
|
||||
{
|
||||
model: Location,
|
||||
include: [ City ]
|
||||
}
|
||||
],
|
||||
attributes: {
|
||||
exclude: [
|
||||
"categoryId",
|
||||
"brandId"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
model: Seat,
|
||||
include: [
|
||||
{
|
||||
model: SeatRow,
|
||||
include: [ SeatGroup ]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
Payment,
|
||||
Address
|
||||
]
|
||||
})
|
||||
.then(orders => {
|
||||
res.status(200).json(orders)
|
||||
})
|
||||
.catch(error => {
|
||||
res.status(500).send()
|
||||
})
|
||||
})
|
||||
console.log(req.body)
|
||||
|
||||
// Place a new order
|
||||
order.post("/", (req: Request, res: Response) => {
|
||||
Order.create(req.body)
|
||||
.then(async order => {
|
||||
for (let ticket of req.body.tickets) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import express from 'express'
|
||||
import cors from 'cors'
|
||||
import bodyParser from 'body-parser'
|
||||
import swaggerJsdoc from "swagger-jsdoc"
|
||||
import swaggerUi from "swagger-ui-express"
|
||||
import { api } from './routes/api.routes'
|
||||
import { startDatabase } from './database'
|
||||
import { order } from './routes/order.routes'
|
||||
@@ -12,6 +14,7 @@ import { location } from './routes/location.routes'
|
||||
import { city } from './routes/city.routes'
|
||||
import { exercises } from './routes/exercise.routes'
|
||||
import { files } from './routes/files.routes'
|
||||
import swaggerFile from './swagger.json'
|
||||
|
||||
const app = express()
|
||||
const port = 3000
|
||||
@@ -46,6 +49,17 @@ app.use("/accounts", account)
|
||||
app.use("/cities", city)
|
||||
app.use("/concerts", concert)
|
||||
|
||||
|
||||
// Swagger API documentation
|
||||
const specs = swaggerJsdoc(swaggerFile);
|
||||
|
||||
app.use(
|
||||
"/api-docs",
|
||||
swaggerUi.serve,
|
||||
swaggerUi.setup(specs, { explorer: true })
|
||||
)
|
||||
|
||||
|
||||
// Start server
|
||||
const server = app.listen(port, () => {
|
||||
console.log(`Server is running and listening to port ${port}`)
|
||||
|
||||
943
backend/swagger.json
Normal file
943
backend/swagger.json
Normal file
@@ -0,0 +1,943 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"definition": {
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "EventMaster API",
|
||||
"version": "0.2.0",
|
||||
"description": "Dokumentation über alle API-Endpunkte des Backends",
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://spdx.org/licenses/MIT.html"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://localhost:3000"
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"JWT": {
|
||||
"type": "apiKey",
|
||||
"in": "header",
|
||||
"name": "Json Web Token"
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"city": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the city"
|
||||
},
|
||||
"country": {
|
||||
"type": "string",
|
||||
"description": "Name of country of the city"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 2,
|
||||
"name": "Hannover",
|
||||
"country": "Germany"
|
||||
}
|
||||
},
|
||||
"loginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"description": "Login successful state"
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Individual created access token"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"success": true,
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjI2MiwiaWF0IjoxNzMzNzYwOTY3fQ.I3rR71c-k2Y2WB0dkd1QEgHxsIRGl4s69YprBNuhX7w"
|
||||
}
|
||||
},
|
||||
"minimalAccount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "Account username"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "Encrypted password"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "E-Mail address of user"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"username": "maxmustermann",
|
||||
"password": "supersecret",
|
||||
"email": "tijjji@didjhli.de"
|
||||
}
|
||||
},
|
||||
"minimalAccountResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "Account username"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "Encrypted password"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "E-Mail address of user"
|
||||
},
|
||||
"accountRoleId": {
|
||||
"type": "number",
|
||||
"description": "ID of account role"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 263,
|
||||
"username": "maxmustermann",
|
||||
"password": "8746fb88adbae61ffa68193ee0bb8050",
|
||||
"email": "tijjji@didjhli.de",
|
||||
"accountRoleId": 1
|
||||
}
|
||||
},
|
||||
"placeOrderBody": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "Account username"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "Encrypted password"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "E-Mail address of user"
|
||||
},
|
||||
"accountRoleId": {
|
||||
"type": "number",
|
||||
"description": "ID of account role"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 263,
|
||||
"username": "maxmustermann",
|
||||
"password": "8746fb88adbae61ffa68193ee0bb8050",
|
||||
"email": "tijjji@didjhli.de",
|
||||
"accountRoleId": 1
|
||||
}
|
||||
},
|
||||
"genre": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the genre"
|
||||
},
|
||||
"bands": {
|
||||
"type": "object",
|
||||
"description": "Bands with this genre object"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 849,
|
||||
"urlName": "palladium",
|
||||
"name": "Palladium",
|
||||
"address": "Schanzenstraße 40",
|
||||
"imageIndoor": "http://localhost:3000/static/locations/palladium-indoor.jpg",
|
||||
"imageOutdoor": "http://localhost:3000/static/locations/palladium-outdoor.jpg",
|
||||
"layout": 1,
|
||||
"capacity": 50,
|
||||
"city": {
|
||||
"id": 250,
|
||||
"name": "Köln",
|
||||
"country": "Germany"
|
||||
},
|
||||
"seatGroups": [
|
||||
{
|
||||
"id": 3949,
|
||||
"name": "A",
|
||||
"surcharge": 30,
|
||||
"capacity": 50,
|
||||
"standingArea": true,
|
||||
"locationId": 849,
|
||||
"seatRows": [
|
||||
{
|
||||
"id": 14999,
|
||||
"row": 0,
|
||||
"seatGroupId": 3949,
|
||||
"seats": [
|
||||
{
|
||||
"id": 108411,
|
||||
"seatNr": 1,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108412,
|
||||
"seatNr": 2,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108413,
|
||||
"seatNr": 3,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108414,
|
||||
"seatNr": 4,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108415,
|
||||
"seatNr": 5,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108416,
|
||||
"seatNr": 6,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108417,
|
||||
"seatNr": 7,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108418,
|
||||
"seatNr": 8,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108419,
|
||||
"seatNr": 9,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108420,
|
||||
"seatNr": 10,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108421,
|
||||
"seatNr": 11,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108422,
|
||||
"seatNr": 12,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108423,
|
||||
"seatNr": 13,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108424,
|
||||
"seatNr": 14,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108425,
|
||||
"seatNr": 15,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108426,
|
||||
"seatNr": 16,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108427,
|
||||
"seatNr": 17,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108428,
|
||||
"seatNr": 18,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108429,
|
||||
"seatNr": 19,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108430,
|
||||
"seatNr": 20,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108431,
|
||||
"seatNr": 21,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108432,
|
||||
"seatNr": 22,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108433,
|
||||
"seatNr": 23,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108434,
|
||||
"seatNr": 24,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108435,
|
||||
"seatNr": 25,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108436,
|
||||
"seatNr": 26,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108437,
|
||||
"seatNr": 27,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108438,
|
||||
"seatNr": 28,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108439,
|
||||
"seatNr": 29,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108440,
|
||||
"seatNr": 30,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108441,
|
||||
"seatNr": 31,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108442,
|
||||
"seatNr": 32,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108443,
|
||||
"seatNr": 33,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108444,
|
||||
"seatNr": 34,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108445,
|
||||
"seatNr": 35,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108446,
|
||||
"seatNr": 36,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108447,
|
||||
"seatNr": 37,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108448,
|
||||
"seatNr": 38,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108449,
|
||||
"seatNr": 39,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108450,
|
||||
"seatNr": 40,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108451,
|
||||
"seatNr": 41,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108452,
|
||||
"seatNr": 42,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108453,
|
||||
"seatNr": 43,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108454,
|
||||
"seatNr": 44,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108455,
|
||||
"seatNr": 45,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108456,
|
||||
"seatNr": 46,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108457,
|
||||
"seatNr": 47,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108458,
|
||||
"seatNr": 48,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108459,
|
||||
"seatNr": 49,
|
||||
"seatRowId": 14999
|
||||
},
|
||||
{
|
||||
"id": 108460,
|
||||
"seatNr": 50,
|
||||
"seatRowId": 14999
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"nrOfConcerts": 0
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the genre"
|
||||
},
|
||||
"bands": {
|
||||
"type": "object",
|
||||
"description": "Bands with this genre object"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 562,
|
||||
"name": "Funk Rock",
|
||||
"bands": [
|
||||
{
|
||||
"images": [
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-1.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-2.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-3.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-4.jpg"
|
||||
],
|
||||
"id": 265,
|
||||
"name": "Red Hot Chili Peppers",
|
||||
"foundingYear": 1983,
|
||||
"descriptionEn": "The Red Hot Chili Peppers are an American rock band formed in Los Angeles in 1983, comprising vocalist Anthony Kiedis, bassist Flea, drummer Chad Smith, and guitarist John Frusciante. Their music incorporates elements of alternative rock, funk, punk rock, hard rock, hip hop, and psychedelic rock. Their eclectic range has influenced genres such as funk metal, rap metal, rap rock, and nu metal. With over 120 million records sold worldwide, the Red Hot Chili Peppers are one of the top-selling bands of all time.",
|
||||
"descriptionDe": "Red Hot Chili Peppers (Abkürzung: RHCP) ist eine 1983 gegründete US-amerikanische Funk- und Alternative-Rockband. Sie zählt zu den kommerziell erfolgreichsten Vertretern des Crossover. Ihr Album Blood Sugar Sex Magik gilt als eines der bedeutendsten dieses Genres.",
|
||||
"imageMembers": "http://localhost:3000/static/bands/red-hot-chili-peppers-members.jpg",
|
||||
"logo": "http://localhost:3000/static/bands/red-hot-chili-peppers-logo.png",
|
||||
"BandGenre": {
|
||||
"id": 793,
|
||||
"genreId": 562,
|
||||
"bandId": 265
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"order": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"orderedAt": {
|
||||
"type": "string",
|
||||
"description": "Timestamp of order"
|
||||
},
|
||||
"tickets": {
|
||||
"type": "array",
|
||||
"description": "Array of Ticket objects"
|
||||
},
|
||||
"addresses": {
|
||||
"type": "object",
|
||||
"description": "Address object"
|
||||
},
|
||||
"payment": {
|
||||
"type": "object",
|
||||
"description": "Payment object"
|
||||
},
|
||||
"account": {
|
||||
"type": "object",
|
||||
"description": "Account object"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 112,
|
||||
"orderedAt": "2024-11-29T12:38:36.381Z",
|
||||
"shipped": false,
|
||||
"tickets": [
|
||||
{
|
||||
"id": 144,
|
||||
"orderId": 112,
|
||||
"orderPrice": 184,
|
||||
"concertId": 892,
|
||||
"seatId": 106331,
|
||||
"concert": {
|
||||
"id": 892,
|
||||
"date": "2024-11-30",
|
||||
"name": "Unlimited Love",
|
||||
"price": 92,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 170,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 834,
|
||||
"band": {
|
||||
"images": [
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-1.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-2.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-3.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-4.jpg"
|
||||
],
|
||||
"id": 265,
|
||||
"name": "Red Hot Chili Peppers",
|
||||
"foundingYear": 1983,
|
||||
"descriptionEn": "The Red Hot Chili Peppers are an American rock band formed in Los Angeles in 1983, comprising vocalist Anthony Kiedis, bassist Flea, drummer Chad Smith, and guitarist John Frusciante. Their music incorporates elements of alternative rock, funk, punk rock, hard rock, hip hop, and psychedelic rock. Their eclectic range has influenced genres such as funk metal, rap metal, rap rock, and nu metal. With over 120 million records sold worldwide, the Red Hot Chili Peppers are one of the top-selling bands of all time.",
|
||||
"descriptionDe": "Red Hot Chili Peppers (Abkürzung: RHCP) ist eine 1983 gegründete US-amerikanische Funk- und Alternative-Rockband. Sie zählt zu den kommerziell erfolgreichsten Vertretern des Crossover. Ihr Album Blood Sugar Sex Magik gilt als eines der bedeutendsten dieses Genres.",
|
||||
"imageMembers": "http://localhost:3000/static/bands/red-hot-chili-peppers-members.jpg",
|
||||
"logo": "http://localhost:3000/static/bands/red-hot-chili-peppers-logo.png"
|
||||
},
|
||||
"location": {
|
||||
"id": 834,
|
||||
"urlName": "swiss-life-hall",
|
||||
"name": "Swiss Life Hall",
|
||||
"address": "Ferdinand-Wilhelm-Fricke-Weg 8",
|
||||
"cityId": 246,
|
||||
"imageIndoor": "http://localhost:3000/static/locations/swiss-life-hall-indoor.jpg",
|
||||
"imageOutdoor": "http://localhost:3000/static/locations/swiss-life-hall-outdoor.jpg",
|
||||
"layout": 2,
|
||||
"capacity": 180,
|
||||
"city": {
|
||||
"id": 246,
|
||||
"name": "Hannover",
|
||||
"country": "Germany"
|
||||
}
|
||||
}
|
||||
},
|
||||
"seat": {
|
||||
"id": 106331,
|
||||
"seatNr": 1,
|
||||
"seatRowId": 14701,
|
||||
"seatRow": {
|
||||
"id": 14701,
|
||||
"row": 0,
|
||||
"seatGroupId": 3872,
|
||||
"seatGroup": {
|
||||
"id": 3872,
|
||||
"name": "A",
|
||||
"surcharge": 30,
|
||||
"capacity": 40,
|
||||
"standingArea": true,
|
||||
"locationId": 834
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"address": {
|
||||
"id": 342,
|
||||
"accountId": 255,
|
||||
"street": "Laportestraße",
|
||||
"houseNumber": 22,
|
||||
"postalCode": 30449,
|
||||
"city": "Hannover"
|
||||
},
|
||||
"payment": {
|
||||
"id": 247,
|
||||
"accountId": 255,
|
||||
"bankName": "Deutsche Bank",
|
||||
"iban": "DE92500105175721645777"
|
||||
},
|
||||
"account": {
|
||||
"id": 255,
|
||||
"username": "hagemeister93",
|
||||
"password": "e1e3981e5b0c009c018c5726a4be5eee",
|
||||
"email": "hagemeister93@gmail.com",
|
||||
"firstName": "Laurin",
|
||||
"lastName": "Hagemeister",
|
||||
"accountRoleId": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"useraccount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "Account username"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "Encrypted password"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "E-Mail address of user"
|
||||
},
|
||||
"firstName": {
|
||||
"type": "string",
|
||||
"description": "First name of user"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string",
|
||||
"description": "Last name of user"
|
||||
},
|
||||
"addresses": {
|
||||
"type": "array",
|
||||
"description": "Array of Address objects"
|
||||
},
|
||||
"accountRole": {
|
||||
"type": "object",
|
||||
"description": "Account role object"
|
||||
},
|
||||
"payments": {
|
||||
"type": "array",
|
||||
"description": "Array of Payments objects"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 262,
|
||||
"username": "max",
|
||||
"password": "06f7a5f329fed099ad36026f9623e6ce",
|
||||
"email": "titi@didi.de",
|
||||
"firstName": "Max",
|
||||
"lastName": "Mustermann",
|
||||
"accountRoleId": 1,
|
||||
"addresses": [
|
||||
{
|
||||
"id": 352,
|
||||
"accountId": 262,
|
||||
"street": "Musterstraße",
|
||||
"houseNumber": 21,
|
||||
"postalCode": 30167,
|
||||
"city": "Hannover"
|
||||
}
|
||||
],
|
||||
"accountRole": {
|
||||
"id": 1,
|
||||
"name": "User",
|
||||
"privilegeBuy": true,
|
||||
"privilegeAdminPanel": false,
|
||||
"privilegeFileAccess": null
|
||||
},
|
||||
"payments": [
|
||||
{
|
||||
"id": 254,
|
||||
"accountId": 262,
|
||||
"bankName": "Deutsche Bank",
|
||||
"iban": "DE293948484738383829"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"exercise": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"nameDe": {
|
||||
"type": "string",
|
||||
"description": "German exercise name"
|
||||
},
|
||||
"nameEn": {
|
||||
"type": "string",
|
||||
"description": "English exercise name"
|
||||
},
|
||||
"exerciseNr": {
|
||||
"type": "number",
|
||||
"description": "Number of exercise in group"
|
||||
},
|
||||
"descriptionDe": {
|
||||
"type": "string",
|
||||
"description": "German description text"
|
||||
},
|
||||
"descriptionEn": {
|
||||
"type": "string",
|
||||
"description": "English description text"
|
||||
},
|
||||
"solved": {
|
||||
"type": "boolean",
|
||||
"description": "State of solved"
|
||||
},
|
||||
"exerciseGroup": {
|
||||
"type": "object",
|
||||
"description": "Exercise group object"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"id": 350,
|
||||
"nameDe": "Registrieren",
|
||||
"nameEn": "Register",
|
||||
"exerciseNr": 1,
|
||||
"descriptionDe": "Wir richten uns einen gewöhnlichen Account auf der Plattform ein. Navigiere hierzu auf die Account-Seite und registriere dich.",
|
||||
"descriptionEn": "Create a new account in the online shop",
|
||||
"solved": true,
|
||||
"exerciseGroup": {
|
||||
"id": 113,
|
||||
"nameDe": "Den Shop kennenlernen",
|
||||
"nameEn": "Getting to know the shop",
|
||||
"groupNr": 0,
|
||||
"descriptionDe": "Vor einem Angriff ist es wichtig zu verstehen, wie die Webseite aufgebaut ist. Wie sind die URLs strukturiert? Wo befinden sich Eingabefelder welche im Backend eine SQL Abfrage stellen?",
|
||||
"descriptionEn": "todo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"folder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of folder"
|
||||
},
|
||||
"nrOrItems": {
|
||||
"type": "number",
|
||||
"description": "Number of files in folder"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"username": "artists",
|
||||
"password": 41
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of file"
|
||||
},
|
||||
"size": {
|
||||
"type": "number",
|
||||
"description": "File size in Bytes"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Text content, only for Text/Code files"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "Resource URL"
|
||||
},
|
||||
"copyright": {
|
||||
"type": "object",
|
||||
"description": "Copyright object"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"name": "alex-turner.jpg",
|
||||
"size": 551625,
|
||||
"content": "",
|
||||
"url": "http://localhost:3000/static/artists/alex-turner.jpg",
|
||||
"copyright": {
|
||||
"image": "alex-turner.jpg",
|
||||
"license": "CC BY 2.0",
|
||||
"creator": "Raph_PH",
|
||||
"url": "https://upload.wikimedia.org/wikipedia/commons/9/95/Alex_Turner%2C_Way_Out_West_2018.jpg"
|
||||
}
|
||||
}
|
||||
},
|
||||
"band": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "The auto-generated id"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the band"
|
||||
},
|
||||
"foundingYear": {
|
||||
"type": "string",
|
||||
"description": "Founding year of the band"
|
||||
},
|
||||
"descriptionEn": {
|
||||
"type": "string",
|
||||
"description": "English description text"
|
||||
},
|
||||
"descriptionDe": {
|
||||
"type": "string",
|
||||
"description": "German description text"
|
||||
},
|
||||
"imageMembers": {
|
||||
"type": "string",
|
||||
"description": "URL to image of band members"
|
||||
},
|
||||
"logo": {
|
||||
"type": "string",
|
||||
"description": "URL to image of band logo"
|
||||
},
|
||||
"genres": {
|
||||
"type": "array",
|
||||
"description": "Array of Genre objects which fits the bands music"
|
||||
},
|
||||
"concerts": {
|
||||
"type": "array",
|
||||
"description": "Array of Concert objects"
|
||||
},
|
||||
"nrOfConcerts": {
|
||||
"type": "number",
|
||||
"description": "Number of concerts"
|
||||
},
|
||||
"rating": {
|
||||
"type": "number",
|
||||
"description": "Average rating of the band"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"images": [
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-1.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-2.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-3.jpg",
|
||||
"http://localhost:3000/static/bands/red-hot-chili-peppers-4.jpg"
|
||||
],
|
||||
"id": 265,
|
||||
"name": "Red Hot Chili Peppers",
|
||||
"foundingYear": 1983,
|
||||
"descriptionEn": "The Red Hot Chili Peppers are an American rock band formed in Los Angeles in 1983, comprising vocalist Anthony Kiedis, bassist Flea, drummer Chad Smith, and guitarist John Frusciante. Their music incorporates elements of alternative rock, funk, punk rock, hard rock, hip hop, and psychedelic rock. Their eclectic range has influenced genres such as funk metal, rap metal, rap rock, and nu metal. With over 120 million records sold worldwide, the Red Hot Chili Peppers are one of the top-selling bands of all time.",
|
||||
"descriptionDe": "Red Hot Chili Peppers (Abkürzung: RHCP) ist eine 1983 gegründete US-amerikanische Funk- und Alternative-Rockband. Sie zählt zu den kommerziell erfolgreichsten Vertretern des Crossover. Ihr Album Blood Sugar Sex Magik gilt als eines der bedeutendsten dieses Genres.",
|
||||
"imageMembers": "http://localhost:3000/static/bands/red-hot-chili-peppers-members.jpg",
|
||||
"logo": "http://localhost:3000/static/bands/red-hot-chili-peppers-logo.png",
|
||||
"genres": [
|
||||
{
|
||||
"name": "Funk Rock"
|
||||
},
|
||||
{
|
||||
"name": "Alternative Rock"
|
||||
},
|
||||
{
|
||||
"name": "Crossover"
|
||||
}
|
||||
],
|
||||
"concerts": [
|
||||
{
|
||||
"id": 892,
|
||||
"date": "2024-11-30",
|
||||
"name": "Unlimited Love",
|
||||
"price": 92,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 170,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 834
|
||||
},
|
||||
{
|
||||
"id": 893,
|
||||
"date": "2024-12-07",
|
||||
"name": "Unlimited Love",
|
||||
"price": 92,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 170,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 834
|
||||
},
|
||||
{
|
||||
"id": 894,
|
||||
"date": "2024-12-11",
|
||||
"name": "Unlimited Love",
|
||||
"price": 119.9,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 8736,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 838
|
||||
},
|
||||
{
|
||||
"id": 895,
|
||||
"date": "2024-12-18",
|
||||
"name": "Unlimited Love",
|
||||
"price": 114.9,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 2793,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 842
|
||||
},
|
||||
{
|
||||
"id": 896,
|
||||
"date": "2024-12-30",
|
||||
"name": "Unlimited Love",
|
||||
"price": 124.9,
|
||||
"image": "http://localhost:3000/static/concerts/unlimited-love-tour.jpg",
|
||||
"inStock": 3079,
|
||||
"offered": true,
|
||||
"bandId": 265,
|
||||
"locationId": 845
|
||||
}
|
||||
],
|
||||
"nrOfConcerts": 5,
|
||||
"rating": 4.428571428571429
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"apis": [
|
||||
"./backend/routes/*.ts"
|
||||
]
|
||||
}
|
||||
309
package-lock.json
generated
309
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "eventmaster",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "eventmaster",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mdi/font": "^7.4.47",
|
||||
@@ -29,6 +29,9 @@
|
||||
"sequelize": "^6.37.4",
|
||||
"sequelize-typescript": "^2.1.6",
|
||||
"sqlite3": "^5.1.7",
|
||||
"swagger-autogen": "^2.23.7",
|
||||
"swagger-jsdoc": "^6.2.8",
|
||||
"swagger-ui-express": "^5.0.1",
|
||||
"vue": "^3.4.29",
|
||||
"vue-i18n": "^10.0.4",
|
||||
"vue-router": "^4.4.5",
|
||||
@@ -44,6 +47,8 @@
|
||||
"@types/jsonwebtoken": "^9.0.7",
|
||||
"@types/multer": "^1.4.12",
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/swagger-jsdoc": "^6.0.4",
|
||||
"@types/swagger-ui-express": "^4.1.7",
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"concurrently": "^9.0.1",
|
||||
"copyfiles": "^2.4.1",
|
||||
@@ -56,6 +61,50 @@
|
||||
"vue-tsc": "^2.1.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@apidevtools/json-schema-ref-parser": {
|
||||
"version": "9.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.1.2.tgz",
|
||||
"integrity": "sha512-r1w81DpR+KyRWd3f+rk6TNqMgedmAxZP5v5KWlXQWlgMUUtyEJch0DKEci1SorPMiSeM8XPl7MZ3miJ60JIpQg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jsdevtools/ono": "^7.1.3",
|
||||
"@types/json-schema": "^7.0.6",
|
||||
"call-me-maybe": "^1.0.1",
|
||||
"js-yaml": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@apidevtools/openapi-schemas": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz",
|
||||
"integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@apidevtools/swagger-methods": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz",
|
||||
"integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@apidevtools/swagger-parser": {
|
||||
"version": "10.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.0.3.tgz",
|
||||
"integrity": "sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
||||
"@apidevtools/openapi-schemas": "^2.0.4",
|
||||
"@apidevtools/swagger-methods": "^3.0.2",
|
||||
"@jsdevtools/ono": "^7.1.3",
|
||||
"call-me-maybe": "^1.0.1",
|
||||
"z-schema": "^5.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"openapi-types": ">=7"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.25.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz",
|
||||
@@ -1546,6 +1595,12 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@jsdevtools/ono": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz",
|
||||
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@malept/cross-spawn-promise": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz",
|
||||
@@ -1933,6 +1988,13 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@scarf/scarf": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz",
|
||||
"integrity": "sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@sideway/address": {
|
||||
"version": "4.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz",
|
||||
@@ -2138,6 +2200,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/jsonwebtoken": {
|
||||
"version": "9.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.7.tgz",
|
||||
@@ -2256,6 +2324,24 @@
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/swagger-jsdoc": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/swagger-jsdoc/-/swagger-jsdoc-6.0.4.tgz",
|
||||
"integrity": "sha512-W+Xw5epcOZrF/AooUM/PccNMSAFOKWZA5dasNyMujTwsBkU74njSJBpvCCJhHAJ95XRMzQrrW844Btu0uoetwQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/swagger-ui-express": {
|
||||
"version": "4.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.7.tgz",
|
||||
"integrity": "sha512-ovLM9dNincXkzH4YwyYpll75vhzPBlWx6La89wwvYH7mHjVpf0X0K/vR/aUM7SRxmr5tt9z7E5XJcjQ46q+S3g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/express": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/validator": {
|
||||
"version": "13.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.2.tgz",
|
||||
@@ -3050,7 +3136,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||
"dev": true,
|
||||
"license": "Python-2.0"
|
||||
},
|
||||
"node_modules/array-flatten": {
|
||||
@@ -3635,6 +3720,12 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/call-me-maybe": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz",
|
||||
"integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/canvg": {
|
||||
"version": "3.0.10",
|
||||
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.10.tgz",
|
||||
@@ -4370,6 +4461,15 @@
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/deepmerge": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
||||
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/defaults": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",
|
||||
@@ -4598,6 +4698,18 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"esutils": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "2.5.7",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.5.7.tgz",
|
||||
@@ -5060,6 +5172,15 @@
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
@@ -5086,9 +5207,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/exifreader/node_modules/@xmldom/xmldom": {
|
||||
"version": "0.9.5",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.5.tgz",
|
||||
"integrity": "sha512-6g1EwSs8cr8JhP1iBxzyVAWM6BIDvx9Y3FZRIQiMDzgG43Pxi8YkWOZ0nQj2NHgNzgXDZbJewFx/n+YAvMZrfg==",
|
||||
"version": "0.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.6.tgz",
|
||||
"integrity": "sha512-Su4xcxR0CPGwlDHNmVP09fqET9YxbyDXHaSob6JlBH7L6reTYaeim6zbk9o08UarO0L5GTRo3uzl0D+9lSxmvw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
@@ -6210,7 +6331,6 @@
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
@@ -6252,7 +6372,6 @@
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
@@ -6444,6 +6563,12 @@
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
@@ -6456,6 +6581,12 @@
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isequal": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
@@ -6480,6 +6611,12 @@
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.mergewith": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz",
|
||||
"integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
@@ -7229,6 +7366,13 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/openapi-types": {
|
||||
"version": "12.1.3",
|
||||
"resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
|
||||
"integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==",
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/ora": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",
|
||||
@@ -8816,6 +8960,116 @@
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-autogen": {
|
||||
"version": "2.23.7",
|
||||
"resolved": "https://registry.npmjs.org/swagger-autogen/-/swagger-autogen-2.23.7.tgz",
|
||||
"integrity": "sha512-vr7uRmuV0DCxWc0wokLJAwX3GwQFJ0jwN+AWk0hKxre2EZwusnkGSGdVFd82u7fQLgwSTnbWkxUL7HXuz5LTZQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^7.4.1",
|
||||
"deepmerge": "^4.2.2",
|
||||
"glob": "^7.1.7",
|
||||
"json5": "^2.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-autogen/node_modules/acorn": {
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-jsdoc": {
|
||||
"version": "6.2.8",
|
||||
"resolved": "https://registry.npmjs.org/swagger-jsdoc/-/swagger-jsdoc-6.2.8.tgz",
|
||||
"integrity": "sha512-VPvil1+JRpmJ55CgAtn8DIcpBs0bL5L3q5bVQvF4tAW/k/9JYSj7dCpaYCAv5rufe0vcCbBRQXGvzpkWjvLklQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "6.2.0",
|
||||
"doctrine": "3.0.0",
|
||||
"glob": "7.1.6",
|
||||
"lodash.mergewith": "^4.6.2",
|
||||
"swagger-parser": "^10.0.3",
|
||||
"yaml": "2.0.0-1"
|
||||
},
|
||||
"bin": {
|
||||
"swagger-jsdoc": "bin/swagger-jsdoc.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-jsdoc/node_modules/commander": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz",
|
||||
"integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-jsdoc/node_modules/glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||
"deprecated": "Glob versions prior to v9 are no longer supported",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-parser": {
|
||||
"version": "10.0.3",
|
||||
"resolved": "https://registry.npmjs.org/swagger-parser/-/swagger-parser-10.0.3.tgz",
|
||||
"integrity": "sha512-nF7oMeL4KypldrQhac8RyHerJeGPD1p2xDh900GPvc+Nk7nWP6jX2FcC7WmkinMoAmoO774+AFXcWsW8gMWEIg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-ui-dist": {
|
||||
"version": "5.18.2",
|
||||
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.18.2.tgz",
|
||||
"integrity": "sha512-J+y4mCw/zXh1FOj5wGJvnAajq6XgHOyywsa9yITmwxIlJbMqITq3gYRZHaeqLVH/eV/HOPphE6NjF+nbSNC5Zw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scarf/scarf": "=1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-ui-express": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz",
|
||||
"integrity": "sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"swagger-ui-dist": ">=5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= v0.10.32"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"express": ">=4.0.0 || >=5.0.0-beta"
|
||||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||
@@ -9642,6 +9896,15 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.0.0-1",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-1.tgz",
|
||||
"integrity": "sha512-W7h5dEhywMKenDJh2iX/LABkbFnBxasD27oyXWDS/feDsxiw0dD5ncXdYXgkvAsXIY2MpW/ZKkr9IU30DBdMNQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "17.7.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||
@@ -9705,6 +9968,36 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/z-schema": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.5.tgz",
|
||||
"integrity": "sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"validator": "^13.7.0"
|
||||
},
|
||||
"bin": {
|
||||
"z-schema": "bin/z-schema"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"commander": "^9.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/z-schema/node_modules/commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/zip-stream": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz",
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
"sequelize": "^6.37.4",
|
||||
"sequelize-typescript": "^2.1.6",
|
||||
"sqlite3": "^5.1.7",
|
||||
"swagger-autogen": "^2.23.7",
|
||||
"swagger-jsdoc": "^6.2.8",
|
||||
"swagger-ui-express": "^5.0.1",
|
||||
"vue": "^3.4.29",
|
||||
"vue-i18n": "^10.0.4",
|
||||
"vue-router": "^4.4.5",
|
||||
@@ -68,6 +71,8 @@
|
||||
"@types/jsonwebtoken": "^9.0.7",
|
||||
"@types/multer": "^1.4.12",
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/swagger-jsdoc": "^6.0.4",
|
||||
"@types/swagger-ui-express": "^4.1.7",
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"concurrently": "^9.0.1",
|
||||
"copyfiles": "^2.4.1",
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function fetchAllAccounts(token: string) {
|
||||
* @returns Response from server with token body
|
||||
*/
|
||||
export async function getLogin(username: string, password: string) {
|
||||
return await axios.get(BASE_URL + "/account/login?username=" + username + "&password=" + password)
|
||||
return await axios.get(BASE_URL + "/login?username=" + username + "&password=" + password)
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function getLogin(username: string, password: string) {
|
||||
* @returns Response from server with account body
|
||||
*/
|
||||
export async function getAccount(token: string) {
|
||||
return await axios.get(BASE_URL + "/account/data", {
|
||||
return await axios.get(BASE_URL + "/account", {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
}
|
||||
@@ -77,9 +77,17 @@ export async function updateAccount(account: AccountModel, token: string) {
|
||||
* Delete an account in servers database
|
||||
*
|
||||
* @param account Account to delete
|
||||
* @param token Validation token
|
||||
*
|
||||
* @returns Response from server
|
||||
*/
|
||||
export async function deleteAccount(account: AccountModel) {
|
||||
return await axios.delete(BASE_URL + "/account/" + account.id)
|
||||
export async function deleteAccount(account: AccountModel, token: string) {
|
||||
return await axios.delete(BASE_URL + "/account", {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
},
|
||||
data: {
|
||||
account: account
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -4,15 +4,19 @@ import { OrderApiModel } from "../models/apiEndpoints/orderApiModel"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/orders"
|
||||
|
||||
export async function fetchUserOrders(userId: number) {
|
||||
return axios.get(BASE_URL + "/" + userId)
|
||||
export async function fetchUserOrders(userId: number, token: string) {
|
||||
return axios.get(BASE_URL + "?id=" + userId, {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function createOrder(
|
||||
accountId: number,
|
||||
basketItem: Array<BasketItemModel>,
|
||||
paymentId: number,
|
||||
addressId: number
|
||||
addressId: number,
|
||||
token: string
|
||||
) {
|
||||
let tickets = []
|
||||
|
||||
@@ -27,10 +31,13 @@ export async function createOrder(
|
||||
}
|
||||
|
||||
return axios.post(BASE_URL, {
|
||||
accountId: accountId,
|
||||
tickets: tickets,
|
||||
paymentId: paymentId,
|
||||
addressId: addressId
|
||||
addressId: addressId,
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const accountStore = useAccountStore()
|
||||
const orderStore = useOrderStore()
|
||||
const router = useRouter()
|
||||
|
||||
orderStore.getOrdersOfAccount(accountStore.userAccount)
|
||||
orderStore.getOrdersOfAccount(accountStore.userAccount, accountStore.userAccountToken)
|
||||
accountStore.refreshAccount()
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useOrderStore } from '@/stores/order.store';
|
||||
const accountStore = useAccountStore()
|
||||
const orderStore = useOrderStore()
|
||||
|
||||
orderStore.getOrdersOfAccount(accountStore.userAccount)
|
||||
orderStore.getOrdersOfAccount(accountStore.userAccount, accountStore.userAccountToken)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -238,7 +238,7 @@ export const useAccountStore = defineStore("accountStore", {
|
||||
async refreshOrders() {
|
||||
this.fetchInProgress = true
|
||||
|
||||
await fetchUserOrders(this.userAccount.id)
|
||||
await fetchUserOrders(this.userAccount.id, this.userAccountToken)
|
||||
.then(result => {
|
||||
this.orders = result.data
|
||||
this.fetchInProgress = false
|
||||
@@ -344,7 +344,7 @@ export const useAccountStore = defineStore("accountStore", {
|
||||
async deleteAccount(account: AccountModel) {
|
||||
this.fetchInProgress = true
|
||||
|
||||
deleteAccount(account)
|
||||
deleteAccount(account, this.userAccountToken)
|
||||
.then(response => {
|
||||
this.fetchInProgress = false
|
||||
})
|
||||
|
||||
@@ -100,10 +100,10 @@ export const useBasketStore = defineStore('basketStore', {
|
||||
const exerciseStore = useExerciseStore()
|
||||
|
||||
await createOrder(
|
||||
accountStore.userAccount.id,
|
||||
this.itemsInBasket,
|
||||
this.usedPayment.id,
|
||||
this.usedAddress.id
|
||||
this.usedAddress.id,
|
||||
accountStore.userAccountToken
|
||||
)
|
||||
.then(async result => {
|
||||
if (result.status == 201) {
|
||||
|
||||
@@ -40,10 +40,10 @@ export const useOrderStore = defineStore("orderStore", {
|
||||
*
|
||||
* @param user User to request orders from
|
||||
*/
|
||||
async getOrdersOfAccount(user: AccountModel) {
|
||||
async getOrdersOfAccount(user: AccountModel, token: string) {
|
||||
this.fetchInProgress = true
|
||||
|
||||
fetchUserOrders(user.id)
|
||||
fetchUserOrders(user.id, token)
|
||||
.then(res => {
|
||||
this.orders = res.data
|
||||
this.fetchInProgress = false
|
||||
|
||||
@@ -68,7 +68,7 @@ export const useSearchStore = defineStore("searchStore", {
|
||||
}
|
||||
|
||||
// Exercise 2.4
|
||||
else if (this.searchTerm.includes("UPDATE")) {
|
||||
else if (this.searchTerm.toUpperCase().includes("UPDATE")) {
|
||||
const accountStore = useAccountStore()
|
||||
await accountStore.refreshAccount()
|
||||
|
||||
@@ -79,7 +79,7 @@ export const useSearchStore = defineStore("searchStore", {
|
||||
}
|
||||
|
||||
// Exercise 2.6
|
||||
else if (this.searchTerm.includes("DELETE")) {
|
||||
else if (this.searchTerm.toUpperCase().includes("DELETE")) {
|
||||
const bandStore = useBandStore()
|
||||
await bandStore.getBand("muse")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user