Add ToursTable, update API documentation

This commit is contained in:
2024-09-26 14:40:41 +02:00
parent da98fc73c0
commit 169fcdf03c
46 changed files with 776 additions and 829 deletions

View File

@@ -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)
})
})