New page for all concerts
This commit is contained in:
@@ -2,6 +2,10 @@ import axios from "axios"
|
||||
|
||||
let BASE_URL = "http://localhost:3000/concerts"
|
||||
|
||||
export async function fetchConcerts() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function getConcert(id: number) {
|
||||
if (id != undefined) {
|
||||
return await axios.get(BASE_URL + "/concert/" + id)
|
||||
@@ -9,3 +13,7 @@ export async function getConcert(id: number) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchConcert(searchTerm: string) {
|
||||
return await axios.get(BASE_URL + '/search?value=' + searchTerm)
|
||||
}
|
||||
@@ -2,11 +2,12 @@ import axios from "axios"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/locations"
|
||||
|
||||
export async function getAllLocations() {
|
||||
export async function fetchAllLocations() {
|
||||
return await axios.get(BASE_URL)
|
||||
}
|
||||
|
||||
export async function getLocation(locationName: string) {
|
||||
console.log(locationName)
|
||||
return await axios.get(BASE_URL + "/location/" + locationName)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { BandModel } from "./bandModel";
|
||||
import { EventApiModel } from "./eventApiModel";
|
||||
import { GenreModel } from "./genreModel"
|
||||
import { MemberModel } from "./memberModel"
|
||||
import { RatingModel } from "./ratingModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /bands
|
||||
*/
|
||||
export class BandApiModel extends BandModel {
|
||||
ratings: Array<RatingModel> = []
|
||||
members: Array<MemberModel> = []
|
||||
genres: Array<GenreModel> = []
|
||||
events: Array<EventApiModel> = []
|
||||
rating: number = 0
|
||||
nrOfConcerts: number = 0
|
||||
}
|
||||
15
software/src/data/models/acts/bandDetailsApiModel.ts
Normal file
15
software/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> = []
|
||||
}
|
||||
@@ -7,4 +7,5 @@ export class BandModel {
|
||||
images: Array<string> = []
|
||||
imageMembers: string = ""
|
||||
logo: string = ""
|
||||
rating: number = 0
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { LocationApiModel } from "../locations/locationApiModel"
|
||||
import { BandModel } from "./bandModel"
|
||||
import { ConcertModel } from "./concertModel"
|
||||
import { EventApiModel } from "./eventApiModel"
|
||||
|
||||
export class ConcertApiModel extends ConcertModel {
|
||||
location: LocationApiModel = new LocationApiModel()
|
||||
event: EventApiModel = new EventApiModel()
|
||||
band: BandModel = new BandModel()
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
export class ConcertModel {
|
||||
id: number = -1
|
||||
inStock: number = 0
|
||||
date: string = ""
|
||||
name: string = ""
|
||||
price: number = 0
|
||||
image: string = ""
|
||||
inStock: number = 0
|
||||
offered: boolean = true
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { EventModel } from "./eventModel";
|
||||
import { BandModel } from "./bandModel"
|
||||
import { ConcertApiModel } from "./concertApiModel";
|
||||
|
||||
export class EventApiModel extends EventModel {
|
||||
concerts: Array<ConcertApiModel> = []
|
||||
band: BandModel = new BandModel()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export class EventModel {
|
||||
id: number = -1
|
||||
name: string = ""
|
||||
offered: boolean = true
|
||||
image: string = ""
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export class RatingModel {
|
||||
id: number = -1
|
||||
rating: number = 1
|
||||
value: number = 0
|
||||
count: number = 0
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
import { ConcertApiModel } from "../acts/concertApiModel"
|
||||
import { CityModel } from "./cityModel"
|
||||
import { LocationModel } from "./locationModel"
|
||||
import { SeatGroupModel } from "./seatGroupModel"
|
||||
|
||||
/**
|
||||
* Replica of the API endpoint /locations
|
||||
*/
|
||||
export class LocationApiModel extends LocationModel {
|
||||
city: CityModel = new CityModel()
|
||||
concerts: Array<ConcertApiModel> = []
|
||||
seatGroups: Array<SeatGroupModel> = []
|
||||
nrOfConcerts: number = 0
|
||||
}
|
||||
@@ -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> = []
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import { PaymentModel } from "../models/user/paymentModel";
|
||||
import { ref } from "vue";
|
||||
import { SelectedSeatModel } from "../models/ordering/selectedSeatModel";
|
||||
import { calcPrice } from "@/scripts/concertScripts";
|
||||
import { EventModel } from "../models/acts/eventModel";
|
||||
import { BandModel } from "../models/acts/bandModel";
|
||||
|
||||
export const useBasketStore = defineStore('basketStore', {
|
||||
@@ -51,28 +50,29 @@ export const useBasketStore = defineStore('basketStore', {
|
||||
)
|
||||
},
|
||||
|
||||
moveSeatSelectionsToBasket(event: EventModel, band: BandModel) {
|
||||
for (let selectedSeat of this.selectedSeats) {
|
||||
let itemInBasket: BasketItemModel = this.itemsInBasket.find((basketItem: BasketItemModel) => {
|
||||
return basketItem.concert.id == selectedSeat.concert.id
|
||||
})
|
||||
moveSeatSelectionsToBasket(event, band: BandModel) {
|
||||
// todo
|
||||
// for (let selectedSeat of this.selectedSeats) {
|
||||
// let itemInBasket: BasketItemModel = this.itemsInBasket.find((basketItem: BasketItemModel) => {
|
||||
// return basketItem.concert.id == selectedSeat.concert.id
|
||||
// })
|
||||
|
||||
if (itemInBasket != undefined) {
|
||||
itemInBasket.seats.push(selectedSeat.seat)
|
||||
} else {
|
||||
this.itemsInBasket.push(
|
||||
new BasketItemModel(
|
||||
selectedSeat.concert,
|
||||
event,
|
||||
band,
|
||||
selectedSeat.seat,
|
||||
selectedSeat.concert.price
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
// if (itemInBasket != undefined) {
|
||||
// itemInBasket.seats.push(selectedSeat.seat)
|
||||
// } else {
|
||||
// this.itemsInBasket.push(
|
||||
// new BasketItemModel(
|
||||
// selectedSeat.concert,
|
||||
// event,
|
||||
// band,
|
||||
// selectedSeat.seat,
|
||||
// selectedSeat.concert.price
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
this.selectedSeats = []
|
||||
// this.selectedSeats = []
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
24
software/src/data/stores/concertStore.ts
Normal file
24
software/src/data/stores/concertStore.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { ConcertApiModel } from "../models/acts/concertApiModel";
|
||||
import { useFeedbackStore } from "./feedbackStore";
|
||||
import { fetchConcerts } from "../api/concertApi";
|
||||
|
||||
export const useConcertStore = defineStore("concertStore", {
|
||||
state: () => ({
|
||||
concerts: ref<Array<ConcertApiModel>>([])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async getConcerts() {
|
||||
const feedbackStore = useFeedbackStore()
|
||||
feedbackStore.fetchDataFromServerInProgress = true
|
||||
|
||||
await fetchConcerts()
|
||||
.then(result => {
|
||||
this.concerts = result.data
|
||||
feedbackStore.fetchDataFromServerInProgress = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
36
software/src/data/stores/locationStore.ts
Normal file
36
software/src/data/stores/locationStore.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { useFeedbackStore } from "./feedbackStore";
|
||||
import { fetchAllLocations } from "../api/locationApi";
|
||||
import { LocationApiModel } from "../models/locations/locationApiModel";
|
||||
import { CityModel } from "../models/locations/cityModel";
|
||||
import { fetchAllCities } from "../api/cityApi";
|
||||
|
||||
export const useLocationStore = defineStore("locationStore", {
|
||||
state: () => ({
|
||||
locations: ref<Array<LocationApiModel>>([]),
|
||||
cities: ref<Array<CityModel>>([])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async getLocations() {
|
||||
const feedbackStore = useFeedbackStore()
|
||||
feedbackStore.fetchDataFromServerInProgress = true
|
||||
|
||||
await fetchAllLocations()
|
||||
.then(result => {
|
||||
this.locations = result.data
|
||||
})
|
||||
|
||||
await fetchAllCities()
|
||||
.then(result => {
|
||||
this.cities = result.data
|
||||
feedbackStore.fetchDataFromServerInProgress = false
|
||||
})
|
||||
},
|
||||
|
||||
getLocationsByCity(city: string): Array<LocationApiModel> {
|
||||
return this.locations.filter(location => location.city.name == city)
|
||||
}
|
||||
},
|
||||
})
|
||||
60
software/src/data/stores/shopStore.ts
Normal file
60
software/src/data/stores/shopStore.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { ConcertApiModel } from "../models/acts/concertApiModel";
|
||||
import { BandApiModel } from "../models/acts/bandApiModel";
|
||||
import { CityApiModel } from "../models/locations/cityApiModel";
|
||||
import { GenreApiModel } from "../models/acts/genreApiModel";
|
||||
import { searchBand } from "../api/bandApi";
|
||||
import { searchLocation } from "../api/locationApi";
|
||||
import { fetchConcerts, searchConcert } from "../api/concertApi";
|
||||
import { useFeedbackStore } from "./feedbackStore";
|
||||
|
||||
export const useShopStore = defineStore("shopStore", {
|
||||
state: () => ({
|
||||
concertsFiltered: ref<Array<ConcertApiModel>>([]),
|
||||
bandsFiltered: ref<Array<BandApiModel>>([]),
|
||||
cities: ref<Array<CityApiModel>>([]),
|
||||
cityFilterName: ref<string>(),
|
||||
genreFilterName: ref<string>(),
|
||||
genres: ref<Array<GenreApiModel>>([]),
|
||||
alreadySearched: ref(false),
|
||||
searchInProgress: ref(false)
|
||||
}),
|
||||
|
||||
actions: {
|
||||
/**
|
||||
* Search for the termin in all bands, locations, events
|
||||
*/
|
||||
async startSearch() {
|
||||
this.alreadySearched = true
|
||||
this.searchInProgress = true
|
||||
|
||||
await searchBand(this.searchTerm)
|
||||
.then(result => {
|
||||
this.bands = result.data
|
||||
})
|
||||
|
||||
await searchLocation(this.searchTerm)
|
||||
.then(result => {
|
||||
this.locations = result.data
|
||||
})
|
||||
|
||||
await searchConcert(this.searchTerm)
|
||||
.then(result => {
|
||||
this.concerts = result.data
|
||||
})
|
||||
|
||||
this.searchInProgress = false
|
||||
},
|
||||
|
||||
async getConcerts() {
|
||||
const feedbackStore = useFeedbackStore()
|
||||
feedbackStore.fetchDataFromServerInProgress = true
|
||||
|
||||
await fetchConcerts()
|
||||
.then(result => {
|
||||
this.concerts = result.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -5,12 +5,10 @@ import { fetchAllCities } from "../api/cityApi";
|
||||
import { fetchAllGenres } from "../api/genreApi";
|
||||
import { useFeedbackStore } from "./feedbackStore";
|
||||
import { CityApiModel } from "../models/locations/cityApiModel";
|
||||
import { EventApiModel } from "../models/acts/eventApiModel";
|
||||
import { GenreApiModel } from "../models/acts/genreApiModel";
|
||||
|
||||
export const useShoppingStore = defineStore("shoppingStore", {
|
||||
state: () => ({
|
||||
events: ref<Array<EventApiModel>>([]),
|
||||
cities: ref<Array<CityApiModel>>([]),
|
||||
genres: ref<Array<GenreApiModel>>([]),
|
||||
cityFilterName: ref<string>(),
|
||||
|
||||
Reference in New Issue
Block a user