Display all bands grouped by genre, create m:n association between Band and Genre in database
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { BelongsToMany, Column, Model, Table } from "sequelize-typescript";
|
||||
import { Band } from "./band.model";
|
||||
import { BandGenre } from "./bandGenre.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Genre extends Model {
|
||||
@@ -9,6 +10,6 @@ export class Genre extends Model {
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Band)
|
||||
@BelongsToMany(() => Band, () => BandGenre)
|
||||
bands: Band[]
|
||||
}
|
||||
Reference in New Issue
Block a user