Add ToursTable, update API documentation
This commit is contained in:
@@ -1,16 +1,42 @@
|
||||
import { Member } from "../models/member.model";
|
||||
import { Band } from "../models/band.model";
|
||||
import { Member } from "../models/acts/member.model";
|
||||
import { Band } from "../models/acts/band.model";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Rating } from "../models/rating.model";
|
||||
import { Genre } from "../models/genre.model";
|
||||
import { Rating } from "../models/acts/rating.model";
|
||||
import { Genre } from "../models/acts/genre.model";
|
||||
|
||||
export const band = Router()
|
||||
|
||||
// Get all bands
|
||||
band.get("/", (req: Request, res: Response) => {
|
||||
Band.findAll({
|
||||
include: [ Member, Rating, Genre ]
|
||||
})
|
||||
Band.findAll()
|
||||
.then(bands => {
|
||||
res.status(200).json(bands)
|
||||
})
|
||||
})
|
||||
|
||||
// Get all information about one band
|
||||
band.get("/:id", (req: Request, res: Response) => {
|
||||
Band.findByPk(req.params.id, {
|
||||
include: [
|
||||
{
|
||||
model: Member,
|
||||
attributes: {
|
||||
exclude: [ "bandId" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
model: Rating,
|
||||
attributes: {
|
||||
exclude: [ "bandId" ]
|
||||
}
|
||||
},
|
||||
Genre
|
||||
],
|
||||
attributes: {
|
||||
exclude: [ "genreId" ]
|
||||
}
|
||||
})
|
||||
.then(band => {
|
||||
res.status(200).json(band)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user