Move software files one directory up, Readme
This commit is contained in:
36
src/data/api/accountApi.ts
Normal file
36
src/data/api/accountApi.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import axios from "axios"
|
||||
import { AccountModel } from "../models/user/accountModel"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/accounts"
|
||||
|
||||
export async function fetchAllAccounts() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function login(username: string, password: string) {
|
||||
return await axios.get(BASE_URL + "/login?username=" + username + "&password=" + password)
|
||||
}
|
||||
|
||||
export async function getAccount(token: string) {
|
||||
return await axios.get(BASE_URL + "/account", {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function registerAccount(account: AccountModel) {
|
||||
return await axios.post(BASE_URL, account)
|
||||
}
|
||||
|
||||
export async function updateAccount(account: AccountModel, token: string) {
|
||||
return await axios.patch(BASE_URL, account, {
|
||||
headers: {
|
||||
"Authorization": token
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteAccount(account: AccountModel) {
|
||||
return await axios.delete(BASE_URL + "/" + account.id)
|
||||
}
|
||||
25
src/data/api/bandApi.ts
Normal file
25
src/data/api/bandApi.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import axios from "axios"
|
||||
import { BandDetailsApiModel } from "../models/acts/bandDetailsApiModel"
|
||||
import { BandModel } from "../models/acts/bandModel"
|
||||
|
||||
let BASE_URL = "http://localhost:3000/bands"
|
||||
|
||||
export async function fetchAllBands() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function fetchBandByName(bandName: string) {
|
||||
return await axios.get(BASE_URL + '/band/' + bandName)
|
||||
}
|
||||
|
||||
export async function fetchBandsBySearchTerm(searchTerm: string) {
|
||||
return await axios.get(BASE_URL + '/search?value=' + searchTerm)
|
||||
}
|
||||
|
||||
export async function postBand(band: BandModel) {
|
||||
return await axios.post(BASE_URL, band)
|
||||
}
|
||||
|
||||
export async function patchBand(band: BandModel) {
|
||||
return await axios.patch(BASE_URL, band)
|
||||
}
|
||||
7
src/data/api/cityApi.ts
Normal file
7
src/data/api/cityApi.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import axios from "axios"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/cities"
|
||||
|
||||
export async function fetchAllCities() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
32
src/data/api/concertApi.ts
Normal file
32
src/data/api/concertApi.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import axios from "axios"
|
||||
|
||||
let BASE_URL = "http://localhost:3000/concerts"
|
||||
|
||||
export async function fetchAllConcerts() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function fetchConcertById(id: number) {
|
||||
if (id != undefined) {
|
||||
return await axios.get(BASE_URL + "/concert/" + id)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns events with the most concerts
|
||||
*
|
||||
* @param nrOfConcerts Limit number of returned objects
|
||||
*
|
||||
* @returns Limited number of objects with the most concerts in it
|
||||
*/
|
||||
export async function fetchUpcomingConcerts(nrOfConcerts: number) {
|
||||
let url = BASE_URL + "?count=" + nrOfConcerts
|
||||
|
||||
return await axios.get(url)
|
||||
}
|
||||
|
||||
export async function fetchConcertsBySearchTerm(searchTerm: string) {
|
||||
return await axios.get(BASE_URL + '/search?value=' + searchTerm)
|
||||
}
|
||||
13
src/data/api/exerciseApi.ts
Normal file
13
src/data/api/exerciseApi.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import axios from "axios"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/exercises"
|
||||
|
||||
export async function fetchAllExerciseGroups() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function updateExercise(exerciseGroupNr: number, exerciseNr: number, state: boolean) {
|
||||
let url = BASE_URL + "/" + exerciseGroupNr + "/" + exerciseNr + "/" + (state ? "1" : "0")
|
||||
|
||||
return await axios.post(url)
|
||||
}
|
||||
45
src/data/api/files.api.ts
Normal file
45
src/data/api/files.api.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import axios from "axios"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/files"
|
||||
|
||||
/**
|
||||
* Fetch all public folders on server
|
||||
*
|
||||
* @returns Response from server
|
||||
*/
|
||||
export function fetchFolderNames() {
|
||||
return axios.get(BASE_URL + "/folders")
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all static file names
|
||||
*
|
||||
* @param dirName Name of folder where to scan files
|
||||
*
|
||||
* @returns Response from server
|
||||
*/
|
||||
export function fetchFileNames(dirName: string) {
|
||||
return axios.get(BASE_URL + "/" + dirName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file to the server
|
||||
*
|
||||
* @param file File to store on server
|
||||
*
|
||||
* @returns Response from server
|
||||
*/
|
||||
export function postFile(file, folder: string) {
|
||||
let formData = new FormData()
|
||||
|
||||
formData.append("file", file)
|
||||
formData.append("folder", folder)
|
||||
|
||||
console.log(formData)
|
||||
|
||||
return axios.post(BASE_URL, formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
22
src/data/api/genreApi.ts
Normal file
22
src/data/api/genreApi.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import axios from "axios"
|
||||
import { GenreModel } from "../models/acts/genreModel"
|
||||
|
||||
let BASE_URL = "http://localhost:3000/genres"
|
||||
|
||||
export async function fetchAllGenres() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function postGenre(genre: GenreModel) {
|
||||
return await axios.post(BASE_URL, genre)
|
||||
}
|
||||
|
||||
export async function patchGenre(genre: GenreModel) {
|
||||
return await axios.patch(BASE_URL, genre)
|
||||
}
|
||||
|
||||
export async function deleteGenre(genre: GenreModel) {
|
||||
return await axios.delete(BASE_URL, {
|
||||
data: genre
|
||||
})
|
||||
}
|
||||
21
src/data/api/locationApi.ts
Normal file
21
src/data/api/locationApi.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import axios from "axios"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/locations"
|
||||
|
||||
export async function fetchAllLocations() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function fetchLocationByName(locationName: string) {
|
||||
return await axios.get(BASE_URL + "/location/" + locationName)
|
||||
}
|
||||
|
||||
export async function fetchTopLocations(nrOfLocations: number) {
|
||||
let url = BASE_URL + "?sort=desc&count=" + nrOfLocations
|
||||
|
||||
return await axios.get(url)
|
||||
}
|
||||
|
||||
export async function fetchLocationsBySearchTerm(searchTerm: string) {
|
||||
return await axios.get(BASE_URL + "/search?value=" + searchTerm)
|
||||
}
|
||||
30
src/data/api/mainApi.ts
Normal file
30
src/data/api/mainApi.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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")
|
||||
}
|
||||
45
src/data/api/orderApi.ts
Normal file
45
src/data/api/orderApi.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import axios from "axios"
|
||||
import { BasketItemModel } from "../models/ordering/basketItemModel"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/orders"
|
||||
|
||||
export async function fetchUserOrders(userId: number) {
|
||||
return axios.get(BASE_URL + "/" + userId)
|
||||
}
|
||||
|
||||
export async function createOrder(
|
||||
accountId: number,
|
||||
basketItem: Array<BasketItemModel>,
|
||||
paymentId: number,
|
||||
addressId: number
|
||||
) {
|
||||
let tickets = []
|
||||
|
||||
for (let item of basketItem) {
|
||||
for (let seat of item.seats) {
|
||||
tickets.push({
|
||||
concertId: item.concert.id,
|
||||
orderPrice: item.price,
|
||||
seatId: seat.id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
console.log({
|
||||
accountId: accountId,
|
||||
tickets: tickets,
|
||||
paymentId: paymentId,
|
||||
addressId: addressId
|
||||
})
|
||||
|
||||
return axios.post(BASE_URL, {
|
||||
accountId: accountId,
|
||||
tickets: tickets,
|
||||
paymentId: paymentId,
|
||||
addressId: addressId
|
||||
})
|
||||
}
|
||||
|
||||
export async function fetchAllOrders() {
|
||||
return axios.get(BASE_URL)
|
||||
}
|
||||
100
src/data/enums/bannerStateEnum.ts
Normal file
100
src/data/enums/bannerStateEnum.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
export enum BannerStateEnum {
|
||||
////////// System feedback //////////
|
||||
|
||||
// Some error
|
||||
ERROR,
|
||||
|
||||
BASKETPRODUCTADDED,
|
||||
|
||||
BASKETPRODUCTREMOVED,
|
||||
|
||||
|
||||
////////// Exercise feedback //////////
|
||||
|
||||
EXERCISESOLVED01,
|
||||
|
||||
EXERCISESOLVED02,
|
||||
|
||||
EXERCISESOLVED03,
|
||||
|
||||
EXERCISESOLVED11,
|
||||
|
||||
EXERCISESOLVED12,
|
||||
|
||||
EXERCISESOLVED13,
|
||||
|
||||
EXERCISESOLVED21,
|
||||
|
||||
EXERCISESOLVED22,
|
||||
|
||||
EXERCISESOLVED23,
|
||||
|
||||
EXERCISESOLVED31,
|
||||
|
||||
EXERCISESOLVED32,
|
||||
|
||||
EXERCISESOLVED33,
|
||||
|
||||
|
||||
////////// API Endpoint /api //////////
|
||||
|
||||
// Status: 200 OK
|
||||
DATABASERESETSUCCESSFUL,
|
||||
|
||||
// Status: 200 OK
|
||||
EXERCISEPROGRESSRESETSUCCESSFUL,
|
||||
|
||||
|
||||
////////// API Endpoint /accounts //////////
|
||||
|
||||
// Status: 200 OK
|
||||
ACCOUNTLOGINSUCCESSFUL,
|
||||
|
||||
// Status: 400 Bad request
|
||||
ACCOUNTLOGINERROR,
|
||||
|
||||
// Status: 401 Unauthorized
|
||||
ACCOUNTLOGINWRONGLOGIN,
|
||||
|
||||
// Status: 201 Created
|
||||
ACCOUNTREGISTERSUCCESSFUL,
|
||||
|
||||
// Status: 400 Bad request
|
||||
ACCOUNTREGISTERERROR,
|
||||
|
||||
// Status: 409 Conflict
|
||||
ACCOUNTREGISTERUSERNAMEINUSE,
|
||||
|
||||
// Status: 200 OK
|
||||
ACCOUNTUPDATESUCCESSFUL,
|
||||
|
||||
// No status code, runs in local cache
|
||||
ACCOUNTLOGOUTSUCCESSFUL,
|
||||
|
||||
|
||||
////////// API Endpoint /orders //////////
|
||||
|
||||
// Status: 201 Created
|
||||
ORDERPLACESUCCESSFUL,
|
||||
|
||||
|
||||
////////// API Endpoint /bands //////////
|
||||
|
||||
BANDSAVEDSUCCESSFUL,
|
||||
|
||||
BANDSAVEDERROR,
|
||||
|
||||
BANDDELETESUCCESSFUL,
|
||||
|
||||
BANDDELETEERROR,
|
||||
|
||||
////////// API Endpoint /genres //////////
|
||||
|
||||
GENRESAVEDSUCCESSFUL,
|
||||
|
||||
GENRESAVEDERROR,
|
||||
|
||||
GENREDELETESUCCESSFUL,
|
||||
|
||||
GENREDELETEERROR
|
||||
}
|
||||
4
src/data/enums/languageEnum.ts
Normal file
4
src/data/enums/languageEnum.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum LanguageEnum {
|
||||
GERMAN = "de",
|
||||
ENGLISH = "en"
|
||||
}
|
||||
5
src/data/enums/serverStateEnum.ts
Normal file
5
src/data/enums/serverStateEnum.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export enum ServerStateEnum {
|
||||
ONLINE,
|
||||
OFFLINE,
|
||||
PENDING
|
||||
}
|
||||
6
src/data/enums/sortOrderEnum.ts
Normal file
6
src/data/enums/sortOrderEnum.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum SortOrder {
|
||||
PRICELOWTOHIGH = "Price: Low to high",
|
||||
PRICEHIGHTOLOW = "Price: High to low",
|
||||
NAMEATOZ = "Name: A to Z",
|
||||
NAMEZTOA = "Name: Z to A"
|
||||
}
|
||||
4
src/data/enums/themeEnums.ts
Normal file
4
src/data/enums/themeEnums.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum ThemeEnum {
|
||||
DARK = "dark",
|
||||
LIGHT = "light",
|
||||
}
|
||||
14
src/data/models/acts/bandApiModel.ts
Normal file
14
src/data/models/acts/bandApiModel.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { BandModel } from "./bandModel";
|
||||
import { ConcertModel } from "./concertModel";
|
||||
import { GenreModel } from "./genreModel"
|
||||
import { MemberModel } from "./memberModel";
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /bands
|
||||
*/
|
||||
export class BandApiModel extends BandModel {
|
||||
members: Array<MemberModel>
|
||||
genres: Array<GenreModel> = []
|
||||
rating: number = 0
|
||||
concerts: Array<ConcertModel> = []
|
||||
}
|
||||
15
src/data/models/acts/bandDetailsApiModel.ts
Normal file
15
src/data/models/acts/bandDetailsApiModel.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { BandModel } from "./bandModel";
|
||||
import { ConcertApiModel } from "./concertApiModel";
|
||||
import { GenreModel } from "./genreModel"
|
||||
import { MemberModel } from "./memberModel";
|
||||
import { RatingModel } from "./ratingModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /bands/band/:name
|
||||
*/
|
||||
export class BandDetailsApiModel extends BandModel {
|
||||
members: Array<MemberModel> = []
|
||||
ratingValues: Array<RatingModel> = []
|
||||
genres: Array<GenreModel> = []
|
||||
concerts: Array<ConcertApiModel> = []
|
||||
}
|
||||
11
src/data/models/acts/bandModel.ts
Normal file
11
src/data/models/acts/bandModel.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export class BandModel {
|
||||
id: number
|
||||
name: string = ""
|
||||
foundingYear: number = 1900
|
||||
descriptionEn: string = ""
|
||||
descriptionDe: string = ""
|
||||
images: Array<string> = []
|
||||
imageMembers: string = ""
|
||||
logo: string = ""
|
||||
rating: number = 0
|
||||
}
|
||||
8
src/data/models/acts/concertApiModel.ts
Normal file
8
src/data/models/acts/concertApiModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { LocationApiModel } from "../locations/locationApiModel"
|
||||
import { BandModel } from "./bandModel"
|
||||
import { ConcertModel } from "./concertModel"
|
||||
|
||||
export class ConcertApiModel extends ConcertModel {
|
||||
location: LocationApiModel = new LocationApiModel()
|
||||
band: BandModel = new BandModel()
|
||||
}
|
||||
8
src/data/models/acts/concertDetailsApiModel.ts
Normal file
8
src/data/models/acts/concertDetailsApiModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { LocationDetailsApiModel } from "../locations/locationDetailsApiModel";
|
||||
import { BandModel } from "./bandModel";
|
||||
import { ConcertModel } from "./concertModel";
|
||||
|
||||
export class ConcertDetailsApiModel extends ConcertModel {
|
||||
location: LocationDetailsApiModel = new LocationDetailsApiModel()
|
||||
band: BandModel = new BandModel()
|
||||
}
|
||||
9
src/data/models/acts/concertModel.ts
Normal file
9
src/data/models/acts/concertModel.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class ConcertModel {
|
||||
id: number = -1
|
||||
date: string = ""
|
||||
name: string = ""
|
||||
price: number = 0
|
||||
image: string = ""
|
||||
inStock: number = 0
|
||||
offered: boolean = true
|
||||
}
|
||||
6
src/data/models/acts/genreApiModel.ts
Normal file
6
src/data/models/acts/genreApiModel.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { GenreModel } from "./genreModel";
|
||||
import { BandModel } from "./bandModel"
|
||||
|
||||
export class GenreApiModel extends GenreModel {
|
||||
bands: Array<BandModel>
|
||||
}
|
||||
4
src/data/models/acts/genreModel.ts
Normal file
4
src/data/models/acts/genreModel.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class GenreModel {
|
||||
id: number
|
||||
name: string = ""
|
||||
}
|
||||
4
src/data/models/acts/memberModel.ts
Normal file
4
src/data/models/acts/memberModel.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class MemberModel {
|
||||
name: string = ""
|
||||
image: string = ""
|
||||
}
|
||||
4
src/data/models/acts/ratingModel.ts
Normal file
4
src/data/models/acts/ratingModel.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class RatingModel {
|
||||
value: number = 0
|
||||
count: number = 0
|
||||
}
|
||||
32
src/data/models/apiEndpoints/orderApiModel.ts
Normal file
32
src/data/models/apiEndpoints/orderApiModel.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { AccountModel } from "../user/accountModel"
|
||||
import { AddressModel } from "../user/addressModel"
|
||||
import { PaymentModel } from "../user/paymentModel"
|
||||
import { OrderModel } from "../ordering/orderModel"
|
||||
import { TicketModel } from "../ordering/ticketModel"
|
||||
import { ConcertApiModel } from "../acts/concertApiModel"
|
||||
import { SeatModel } from "../locations/seatModel"
|
||||
import { SeatRowModel } from "../locations/seatRowModel"
|
||||
import { SeatGroupModel } from "../locations/seatGroupModel"
|
||||
|
||||
/**
|
||||
* Replica of API endpoint /orders/:id
|
||||
*/
|
||||
export class OrderApiModel extends OrderModel {
|
||||
tickets: Array<TicketOrderModel>
|
||||
account: AccountModel
|
||||
payment: PaymentModel
|
||||
address: AddressModel
|
||||
}
|
||||
|
||||
class TicketOrderModel extends TicketModel {
|
||||
concert: ConcertApiModel
|
||||
seat: SeatTicketModel
|
||||
}
|
||||
|
||||
class SeatTicketModel extends SeatModel {
|
||||
seatRow: SeatRowTicketModel
|
||||
}
|
||||
|
||||
class SeatRowTicketModel extends SeatRowModel {
|
||||
seatGroup: SeatGroupModel
|
||||
}
|
||||
8
src/data/models/exercises/exerciseGroupModel.ts
Normal file
8
src/data/models/exercises/exerciseGroupModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export class ExerciseGroupModel {
|
||||
id = -1
|
||||
nameDe: string = ""
|
||||
nameEn: string = ""
|
||||
groupNr: number = 0
|
||||
descriptionDe: string = ""
|
||||
descriptionEn: string = ""
|
||||
}
|
||||
12
src/data/models/exercises/exerciseModel.ts
Normal file
12
src/data/models/exercises/exerciseModel.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ExerciseGroupModel } from "./exerciseGroupModel"
|
||||
|
||||
export class ExerciseModel {
|
||||
id = -1
|
||||
nameDe: string = ""
|
||||
nameEn: string = ""
|
||||
exerciseNr: number = 0
|
||||
descriptionDe: string = ""
|
||||
descriptionEn: string = ""
|
||||
solved: boolean = false
|
||||
exerciseGroup: ExerciseGroupModel
|
||||
}
|
||||
12
src/data/models/locations/cityApiModel.ts
Normal file
12
src/data/models/locations/cityApiModel.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { LocationApiModel } from "./locationApiModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /cities
|
||||
*/
|
||||
export class CityApiModel {
|
||||
id: number = -1
|
||||
name: string = ""
|
||||
country: string = ""
|
||||
image: string = ""
|
||||
locations: Array<LocationApiModel>
|
||||
}
|
||||
6
src/data/models/locations/cityModel.ts
Normal file
6
src/data/models/locations/cityModel.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class CityModel {
|
||||
id: number = -1
|
||||
name: string = ""
|
||||
country: string = ""
|
||||
image: string = ""
|
||||
}
|
||||
10
src/data/models/locations/locationApiModel.ts
Normal file
10
src/data/models/locations/locationApiModel.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CityModel } from "./cityModel"
|
||||
import { LocationModel } from "./locationModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /locations
|
||||
*/
|
||||
export class LocationApiModel extends LocationModel {
|
||||
city: CityModel = new CityModel()
|
||||
nrOfConcerts: number = 0
|
||||
}
|
||||
13
src/data/models/locations/locationDetailsApiModel.ts
Normal file
13
src/data/models/locations/locationDetailsApiModel.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ConcertApiModel } from "../acts/concertApiModel"
|
||||
import { CityModel } from "./cityModel"
|
||||
import { LocationModel } from "./locationModel"
|
||||
import { SeatGroupModel } from "./seatGroupModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /locations/location/:name
|
||||
*/
|
||||
export class LocationDetailsApiModel extends LocationModel {
|
||||
city: CityModel = new CityModel()
|
||||
concerts: Array<ConcertApiModel> = []
|
||||
seatGroups: Array<SeatGroupModel> = []
|
||||
}
|
||||
10
src/data/models/locations/locationModel.ts
Normal file
10
src/data/models/locations/locationModel.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export class LocationModel {
|
||||
id: number = -1
|
||||
name: string = ""
|
||||
address: string = ""
|
||||
imageIndoor: string = ""
|
||||
imageOutdoor: string = ""
|
||||
capacity: number = 0
|
||||
layout: number = 1
|
||||
urlName: string = ""
|
||||
}
|
||||
10
src/data/models/locations/seatGroupModel.ts
Normal file
10
src/data/models/locations/seatGroupModel.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { SeatRowModel } from "./seatRowModel"
|
||||
|
||||
export class SeatGroupModel {
|
||||
name: string = ""
|
||||
surcharge: number = 0
|
||||
standingArea: boolean = false
|
||||
capacity: number = 0
|
||||
occupied: number = 0
|
||||
seatRows: Array<SeatRowModel>
|
||||
}
|
||||
5
src/data/models/locations/seatModel.ts
Normal file
5
src/data/models/locations/seatModel.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export class SeatModel {
|
||||
id: number = -1
|
||||
seatNr: number = 0
|
||||
state: number = 0
|
||||
}
|
||||
6
src/data/models/locations/seatRowModel.ts
Normal file
6
src/data/models/locations/seatRowModel.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SeatModel } from "./seatModel"
|
||||
|
||||
export class SeatRowModel {
|
||||
row: number = 0
|
||||
seats: Array<SeatModel>
|
||||
}
|
||||
17
src/data/models/ordering/basketItemModel.ts
Normal file
17
src/data/models/ordering/basketItemModel.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { BandModel } from "../acts/bandModel"
|
||||
import { ConcertModel } from "../acts/concertModel"
|
||||
import { SeatModel } from "../locations/seatModel"
|
||||
|
||||
export class BasketItemModel {
|
||||
concert: ConcertModel
|
||||
band: BandModel = new BandModel()
|
||||
seats: Array<SeatModel> = []
|
||||
price: number
|
||||
|
||||
constructor(concert: ConcertModel, band: BandModel, seat: SeatModel, price: number) {
|
||||
this.concert = concert
|
||||
this.band = band
|
||||
this.seats = [ seat ]
|
||||
this.price = price
|
||||
}
|
||||
}
|
||||
5
src/data/models/ordering/orderModel.ts
Normal file
5
src/data/models/ordering/orderModel.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export class OrderModel {
|
||||
id: number
|
||||
orderedAt: string
|
||||
shipped: boolean
|
||||
}
|
||||
17
src/data/models/ordering/selectedSeatModel.ts
Normal file
17
src/data/models/ordering/selectedSeatModel.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ConcertModel } from "../acts/concertModel";
|
||||
import { SeatModel } from "../locations/seatModel";
|
||||
|
||||
export class SelectedSeatModel {
|
||||
seat: SeatModel
|
||||
seatRow: number
|
||||
seatGroupName: string
|
||||
concert: ConcertModel
|
||||
price: number
|
||||
|
||||
constructor(seat: SeatModel, seatRow: number, seatGroupName: string, concert: ConcertModel) {
|
||||
this.seat = seat
|
||||
this.seatRow = seatRow
|
||||
this.seatGroupName = seatGroupName
|
||||
this.concert = concert
|
||||
}
|
||||
}
|
||||
8
src/data/models/ordering/ticketApiModel.ts
Normal file
8
src/data/models/ordering/ticketApiModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { ConcertApiModel } from "../acts/concertApiModel";
|
||||
import { SeatModel } from "../locations/seatModel";
|
||||
import { TicketModel } from "./ticketModel";
|
||||
|
||||
export class TicketApiModel extends TicketModel {
|
||||
concert: ConcertApiModel
|
||||
seat: SeatModel
|
||||
}
|
||||
6
src/data/models/ordering/ticketModel.ts
Normal file
6
src/data/models/ordering/ticketModel.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class TicketModel {
|
||||
id: number
|
||||
orderId: number = -1
|
||||
orderPrice: number = 0
|
||||
concertId: number = 0
|
||||
}
|
||||
10
src/data/models/user/accountApiModel.ts
Normal file
10
src/data/models/user/accountApiModel.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AccountModel } from "./accountModel"
|
||||
import { AccountRole } from "./accountRole"
|
||||
import { AddressModel } from "./addressModel"
|
||||
import { PaymentModel } from "./paymentModel"
|
||||
|
||||
export class AccountApiModel extends AccountModel {
|
||||
addresses: Array<AddressModel>
|
||||
payments: Array<PaymentModel>
|
||||
accountRole: AccountRole = new AccountRole()
|
||||
}
|
||||
8
src/data/models/user/accountModel.ts
Normal file
8
src/data/models/user/accountModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export class AccountModel {
|
||||
id: number
|
||||
username: string = ""
|
||||
password: string = ""
|
||||
email: string = ""
|
||||
firstName: string = ""
|
||||
lastName: string = ""
|
||||
}
|
||||
5
src/data/models/user/accountRole.ts
Normal file
5
src/data/models/user/accountRole.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export class AccountRole {
|
||||
name: string = ""
|
||||
privilegeBuy: boolean = false
|
||||
privilegeAdminPanel: boolean = false
|
||||
}
|
||||
6
src/data/models/user/addressModel.ts
Normal file
6
src/data/models/user/addressModel.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class AddressModel {
|
||||
street: string = ""
|
||||
houseNumber: number
|
||||
postalCode: number
|
||||
city: string = ""
|
||||
}
|
||||
4
src/data/models/user/paymentModel.ts
Normal file
4
src/data/models/user/paymentModel.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class PaymentModel {
|
||||
bankName: string = ""
|
||||
iban: string = ""
|
||||
}
|
||||
Reference in New Issue
Block a user