Move software files one directory up, Readme
This commit is contained in:
17
backend/models/locations/city.model.ts
Normal file
17
backend/models/locations/city.model.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Location } from "./location.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class City extends Model {
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@Column
|
||||
country: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Location)
|
||||
locations: Location[]
|
||||
}
|
||||
50
backend/models/locations/location.model.ts
Normal file
50
backend/models/locations/location.model.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Concert } from "../acts/concert.model";
|
||||
import { City } from "./city.model";
|
||||
import { SeatGroup } from "./seatGroup.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Location extends Model {
|
||||
@Column
|
||||
urlName: string
|
||||
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@Column
|
||||
address: string
|
||||
|
||||
@ForeignKey(() => City)
|
||||
@Column
|
||||
cityId: number
|
||||
|
||||
@Column
|
||||
imageIndoor: string
|
||||
|
||||
@Column
|
||||
imageOutdoor: string
|
||||
|
||||
/**
|
||||
* Layout identifier of the location
|
||||
* 1 = Stage with simple stay area
|
||||
* 2 = Stage with front stay area and seat places around
|
||||
* 3 = Stage in the middle of the stay area, seat places all around
|
||||
*/
|
||||
@Column
|
||||
layout: number
|
||||
|
||||
@Column
|
||||
capacity: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Concert)
|
||||
concerts: Concert[]
|
||||
|
||||
@HasMany(() => SeatGroup)
|
||||
seatGroups: SeatGroup[]
|
||||
|
||||
@BelongsTo(() => City)
|
||||
city: City
|
||||
}
|
||||
22
backend/models/locations/seat.model.ts
Normal file
22
backend/models/locations/seat.model.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { SeatRow } from "./seatRow.model";
|
||||
import { Ticket } from "../ordering/ticket.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Seat extends Model {
|
||||
@Column
|
||||
seatNr: number
|
||||
|
||||
@ForeignKey(() => SeatRow)
|
||||
@Column
|
||||
seatRowId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => SeatRow)
|
||||
seatRow: SeatRow
|
||||
|
||||
@HasMany(() => Ticket)
|
||||
tickets: Ticket[]
|
||||
}
|
||||
32
backend/models/locations/seatGroup.model.ts
Normal file
32
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
backend/models/locations/seatRow.model.ts
Normal file
22
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