diff --git a/software/backend/routes/band.routes.ts b/software/backend/routes/band.routes.ts index f7add46..8632cbc 100644 --- a/software/backend/routes/band.routes.ts +++ b/software/backend/routes/band.routes.ts @@ -59,7 +59,7 @@ band.get("/", (req: Request, res: Response) => { }) // Get all information about one band -band.get("/:name", (req: Request, res: Response) => { +band.get("/band/:name", (req: Request, res: Response) => { Band.findOne({ where: { name: { [Op.like]: req.params.name } @@ -109,4 +109,19 @@ band.get("/:name", (req: Request, res: Response) => { .then(band => { res.status(200).json(band) }) +}) + + +// Band search +band.get("/search", (req: Request, res: Response) => { + Band.findAll({ + where: { + name: { + [Op.substring]: req.query.value + } + } + }) + .then(bands => { + res.status(200).json(bands) + }) }) \ No newline at end of file diff --git a/software/backend/routes/concert.routes.ts b/software/backend/routes/concert.routes.ts index 9ae1c5b..67adb3b 100644 --- a/software/backend/routes/concert.routes.ts +++ b/software/backend/routes/concert.routes.ts @@ -8,10 +8,11 @@ import { SeatRow } from "../models/locations/seatRow.model"; import { Seat } from "../models/locations/seat.model"; import { Ticket } from "../models/ordering/ticket.model"; import { Band } from "../models/acts/band.model"; +import { Op } from "sequelize"; export const concert = Router() -concert.get("/:id", (req: Request, res: Response) => { +concert.get("/concert/:id", (req: Request, res: Response) => { Concert.findByPk(req.params.id, { include: [ { diff --git a/software/backend/routes/events.routes.ts b/software/backend/routes/events.routes.ts index 382ea3b..88dac73 100644 --- a/software/backend/routes/events.routes.ts +++ b/software/backend/routes/events.routes.ts @@ -5,6 +5,7 @@ import { Request, Response, Router } from "express"; import { Location } from "../models/locations/location.model"; import { Genre } from "../models/acts/genre.model"; import { City } from "../models/locations/city.model"; +import { Op } from "sequelize"; export const events = Router() @@ -80,5 +81,33 @@ events.get("/", async (req: Request, res: Response) => { res.status(200).json(events) }) +}) + +// Event search +events.get("/search", (req: Request, res: Response) => { + Event.findAll({ + where: { + name: { + [Op.substring]: req.query.value + } + }, + include: [ + { + model: Concert, + required: true, + include: [ + { + model: Location, + } + ], + }, + { + model: Band, + } + ] + }) + .then(events => { + res.status(200).json(events) + }) }) \ No newline at end of file diff --git a/software/backend/routes/location.routes.ts b/software/backend/routes/location.routes.ts index 17dc8f7..0782544 100644 --- a/software/backend/routes/location.routes.ts +++ b/software/backend/routes/location.routes.ts @@ -7,6 +7,7 @@ import { Band } from "../models/acts/band.model"; import { SeatGroup } from "../models/locations/seatGroup.model"; import { Seat } from "../models/locations/seat.model"; import { SeatRow } from "../models/locations/seatRow.model"; +import { Op } from "sequelize"; export const location = Router() @@ -69,7 +70,7 @@ location.get("/", (req: Request, res: Response) => { }) }) -location.get("/:urlName", (req: Request, res: Response) => { +location.get("/location/:urlName", (req: Request, res: Response) => { Location.findOne({ where: { urlName: req.params.urlName }, include: [ @@ -117,4 +118,19 @@ location.get("/:urlName", (req: Request, res: Response) => { res.status(200).json(location) }) +}) + + +// Location search +location.get("/search", (req: Request, res: Response) => { + Location.findAll({ + where: { + name: { + [Op.substring]: req.query.value + } + } + }) + .then(locations => { + res.status(200).json(locations) + }) }) \ No newline at end of file diff --git a/software/src/App.vue b/software/src/App.vue index 72ce751..a42311f 100644 --- a/software/src/App.vue +++ b/software/src/App.vue @@ -6,38 +6,21 @@ import navigationAppendItems from './components/navigation/navigationAppendItems import navigationPrependItems from './components/navigation/navigationPrependItems.vue'; import { usePreferencesStore } from './data/stores/preferencesStore'; import { useFeedbackStore } from './data/stores/feedbackStore'; -import { useConcertStore } from './data/stores/concertStore'; -import { LocationModel } from './data/models/locations/locationModel'; import { useShoppingStore } from './data/stores/shoppingStore'; import footerItems from './components/navigation/footerItems.vue'; const preferencesStore = usePreferencesStore() -const concertStore = useConcertStore() const feedbackStore = useFeedbackStore() const shoppingStore = useShoppingStore() const theme = useTheme() theme.global.name.value = preferencesStore.theme -concertStore.fetchAllTours() // Global watcher watch(() => preferencesStore.language, () => { i18n.global.locale = preferencesStore.language }, { immediate: true }) - -watch(() => concertStore.cityFilter, () => { - concertStore.locationFilter = new LocationModel() - concertStore.filterTours() -}) - -watch(() => concertStore.locationFilter, () => { - concertStore.filterTours() -}) - -watch(() => concertStore.genreFilter, () => { - concertStore.filterTours() -})