Adding Seat plan component and database tables
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Location } from "./location.model";
|
||||
import { Location } from "./../locations/location.model";
|
||||
import { Tour } from "./tour.model";
|
||||
import { OrderItem } from "../ordering/orderItem.model";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Concert } from "./concert.model";
|
||||
import { Concert } from "./../acts/concert.model";
|
||||
import { City } from "./city.model";
|
||||
import { SeatGroup } from "./seatGroup.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Location extends Model {
|
||||
@@ -23,6 +24,9 @@ export class Location extends Model {
|
||||
@HasMany(() => Concert)
|
||||
concerts: Concert[]
|
||||
|
||||
@HasMany(() => SeatGroup)
|
||||
seatGroups: SeatGroup[]
|
||||
|
||||
@BelongsTo(() => City)
|
||||
city: City
|
||||
}
|
||||
18
software/backend/models/locations/seat.model.ts
Normal file
18
software/backend/models/locations/seat.model.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { SeatRow } from "./seatRow.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Seat extends Model {
|
||||
@Column
|
||||
seatNr: number
|
||||
|
||||
@ForeignKey(() => SeatRow)
|
||||
@Column
|
||||
seatRowId: Number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => SeatRow)
|
||||
seatRow: SeatRow
|
||||
}
|
||||
32
software/backend/models/locations/seatGroup.model.ts
Normal file
32
software/backend/models/locations/seatGroup.model.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { BelongsTo, Column, Default, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Location } from "./location.model";
|
||||
import { SeatRow } from "./seatRow.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class SeatGroup extends Model {
|
||||
@Column
|
||||
name: String
|
||||
|
||||
@Column
|
||||
surcharge: Number
|
||||
|
||||
@Column
|
||||
capacity: Number
|
||||
|
||||
@Default(false)
|
||||
@Column
|
||||
standingArea: Boolean
|
||||
|
||||
@ForeignKey(() => Location)
|
||||
@Column
|
||||
locationId: Number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Location)
|
||||
location: Location
|
||||
|
||||
@HasMany(() => SeatRow)
|
||||
seatRows: SeatRow[]
|
||||
}
|
||||
22
software/backend/models/locations/seatRow.model.ts
Normal file
22
software/backend/models/locations/seatRow.model.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { SeatGroup } from "./seatGroup.model";
|
||||
import { Seat } from "./seat.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class SeatRow extends Model {
|
||||
@Column
|
||||
row: number
|
||||
|
||||
@ForeignKey(() => SeatGroup)
|
||||
@Column
|
||||
seatGroupId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => SeatGroup)
|
||||
seatGroup: SeatGroup
|
||||
|
||||
@HasMany(() => Seat)
|
||||
seats: Seat[]
|
||||
}
|
||||
Reference in New Issue
Block a user