Creating whole Band details page
This commit is contained in:
@@ -3,13 +3,54 @@ import { Band } from "../models/acts/band.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Rating } from "../models/acts/rating.model";
|
||||
import { Genre } from "../models/acts/genre.model";
|
||||
import { Tour } from "../models/acts/tour.model";
|
||||
import { Concert } from "../models/acts/concert.model";
|
||||
import { Location } from "../models/acts/location.model";
|
||||
import { City } from "../models/acts/city.model";
|
||||
|
||||
export const band = Router()
|
||||
|
||||
// Get all bands
|
||||
band.get("/", (req: Request, res: Response) => {
|
||||
Band.findAll({
|
||||
include: [ Genre, Rating ]
|
||||
include: [
|
||||
{
|
||||
model: Member,
|
||||
attributes: {
|
||||
exclude: [ "id", "bandId" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
model: Rating,
|
||||
attributes: {
|
||||
exclude: [ "id", "bandId" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
model: Tour,
|
||||
include: [
|
||||
{
|
||||
model: Concert,
|
||||
include: [
|
||||
{
|
||||
model: Location,
|
||||
include: [ City ],
|
||||
attributes: {
|
||||
exclude: [ "id" ]
|
||||
}
|
||||
}
|
||||
],
|
||||
attributes: {
|
||||
exclude: [ "id", "tourId", "locationId" ]
|
||||
}
|
||||
}
|
||||
],
|
||||
attributes: {
|
||||
exclude: [ "id", "bandId" ]
|
||||
}
|
||||
},
|
||||
Genre
|
||||
]
|
||||
})
|
||||
.then(bands => {
|
||||
res.status(200).json(bands)
|
||||
|
||||
Reference in New Issue
Block a user