Improve filterBar on eventsPage, improve API access from frontend
This commit is contained in:
@@ -78,8 +78,6 @@ account.post("/", (req: Request, res: Response) => {
|
||||
})
|
||||
|
||||
account.patch("/", (req: Request, res: Response) => {
|
||||
console.log(req.body)
|
||||
|
||||
Account.update(req.body,
|
||||
{
|
||||
where: { id: req.body.id }
|
||||
|
||||
@@ -6,14 +6,7 @@ import { Request, Response, Router } from "express";
|
||||
export const genre = Router()
|
||||
|
||||
genre.get("/", (req: Request, res: Response) => {
|
||||
Genre.findAll({
|
||||
include: [
|
||||
{
|
||||
model: Band,
|
||||
include: [ Rating ]
|
||||
}
|
||||
]
|
||||
})
|
||||
Genre.findAll()
|
||||
.then(genres => {
|
||||
res.status(200).json(genres)
|
||||
})
|
||||
|
||||
@@ -38,12 +38,12 @@ location.get("/", (req: Request, res: Response) => {
|
||||
.then(async locations => {
|
||||
for (let location of locations) {
|
||||
for (let concert of location.dataValues.concerts) {
|
||||
let tour = concert.dataValues.tour
|
||||
let event = concert.dataValues.event
|
||||
|
||||
await Band.findByPk(tour.dataValues.bandId)
|
||||
await Band.findByPk(event.dataValues.bandId)
|
||||
.then(band => {
|
||||
tour.dataValues.bandName = band.dataValues.name
|
||||
delete tour.dataValues.bandId
|
||||
event.dataValues.bandName = band.dataValues.name
|
||||
delete event.dataValues.bandId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user