Display all bands grouped by genre, create m:n association between Band and Genre in database

This commit is contained in:
2024-09-27 23:25:24 +02:00
parent 513c73c5c1
commit 8d0b141217
29 changed files with 275 additions and 165 deletions

View File

@@ -1,10 +1,19 @@
import { Rating } from "../models/acts/rating.model";
import { Band } from "../models/acts/band.model";
import { Genre } from "../models/acts/genre.model";
import { Request, Response, Router } from "express";
export const genre = Router()
genre.get("/", (req: Request, res: Response) => {
Genre.findAll()
Genre.findAll({
include: [
{
model: Band,
include: [ Rating ]
}
]
})
.then(genres => {
res.status(200).json(genres)
})