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

@@ -0,0 +1,53 @@
import { BelongsTo, Column, DataType, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
import { Member } from "./member.model";
import { Genre } from "./genre.model";
import { Rating } from "./rating.model";
import { Tour } from "./tour.model";
@Table({ timestamps: false })
export class Band extends Model {
@Column
name: String
@Column
foundingYear: Number
@Column
descriptionEn: String
@Column
descriptionDe: String
@Column({
type: DataType.STRING,
get(): Array<string> {
return this.getDataValue('images').split(';')
},
set(value: Array<string>) {
this.setDataValue('images', value.join(';'))
}
})
images: Array<String>
@Column
logo: String
@ForeignKey(() => Genre)
@Column
genreId: Number
// Relations
@HasMany(() => Member)
members: Member[]
@HasMany(() => Rating)
ratings: Rating[]
@HasMany(() => Tour)
tours: Tour[]
@BelongsTo(() => Genre)
genre: Genre
}