Move software files one directory up, Readme
This commit is contained in:
53
backend/models/acts/band.model.ts
Normal file
53
backend/models/acts/band.model.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { BelongsTo, BelongsToMany, 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 { BandGenre } from "./bandGenre.model";
|
||||
import { Concert } from "./concert.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
|
||||
imageMembers: string
|
||||
|
||||
@Column
|
||||
logo: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Member)
|
||||
members: Member[]
|
||||
|
||||
@HasMany(() => Rating)
|
||||
ratings: Rating[]
|
||||
|
||||
@HasMany(() => Concert)
|
||||
concerts: Concert[]
|
||||
|
||||
@BelongsToMany(() => Genre, () => BandGenre)
|
||||
genres: Genre[]
|
||||
}
|
||||
16
backend/models/acts/bandGenre.model.ts
Normal file
16
backend/models/acts/bandGenre.model.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Column, ForeignKey, Model, PrimaryKey, Table } from "sequelize-typescript";
|
||||
import { Genre } from "./genre.model";
|
||||
import { Band } from "./band.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class BandGenre extends Model {
|
||||
@PrimaryKey
|
||||
@Column({autoIncrement: true})
|
||||
declare id: number
|
||||
|
||||
@ForeignKey(() => Genre)
|
||||
genreId: number
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
bandId: number
|
||||
}
|
||||
45
backend/models/acts/concert.model.ts
Normal file
45
backend/models/acts/concert.model.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Location } from "../locations/location.model";
|
||||
import { Ticket } from "../ordering/ticket.model";
|
||||
import { Band } from "./band.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Concert extends Model {
|
||||
@Column
|
||||
date: string
|
||||
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@Column
|
||||
price: number
|
||||
|
||||
@Column
|
||||
image: string
|
||||
|
||||
@Column
|
||||
inStock: number
|
||||
|
||||
@Column
|
||||
offered: boolean
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
@Column
|
||||
bandId: number
|
||||
|
||||
@ForeignKey(() => Location)
|
||||
@Column
|
||||
locationId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Band)
|
||||
band: Band
|
||||
|
||||
@BelongsTo(() => Location)
|
||||
location: Location
|
||||
|
||||
@HasMany(() => Ticket)
|
||||
tickets: Ticket[]
|
||||
}
|
||||
15
backend/models/acts/genre.model.ts
Normal file
15
backend/models/acts/genre.model.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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 {
|
||||
@Column
|
||||
name: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsToMany(() => Band, () => BandGenre)
|
||||
bands: Band[]
|
||||
}
|
||||
21
backend/models/acts/member.model.ts
Normal file
21
backend/models/acts/member.model.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { Band } from "./band.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Member extends Model {
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
@Column
|
||||
bandId: number
|
||||
|
||||
@Column
|
||||
image: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Band)
|
||||
bands: Band[]
|
||||
}
|
||||
27
backend/models/acts/rating.model.ts
Normal file
27
backend/models/acts/rating.model.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "../user/account.model";
|
||||
import { Band } from "./band.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Rating extends Model {
|
||||
|
||||
@ForeignKey(() => Account)
|
||||
@Column
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
rating: number
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
@Column
|
||||
bandId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@BelongsTo(() => Band)
|
||||
band: Band
|
||||
}
|
||||
33
backend/models/exercises/exercise.model.ts
Normal file
33
backend/models/exercises/exercise.model.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { ExerciseGroup } from "./exerciseGroup.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Exercise extends Model {
|
||||
@Column
|
||||
nameDe: string
|
||||
|
||||
@Column
|
||||
nameEn: string
|
||||
|
||||
@Column
|
||||
exerciseNr: number
|
||||
|
||||
@Column
|
||||
descriptionDe: string
|
||||
|
||||
@Column
|
||||
descriptionEn: string
|
||||
|
||||
@Column
|
||||
solved: boolean
|
||||
|
||||
@ForeignKey(() => ExerciseGroup)
|
||||
@Column
|
||||
exerciseGroupId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => ExerciseGroup)
|
||||
exerciseGroup: ExerciseGroup
|
||||
}
|
||||
26
backend/models/exercises/exerciseGroup.model.ts
Normal file
26
backend/models/exercises/exerciseGroup.model.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Exercise } from "./exercise.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class ExerciseGroup extends Model {
|
||||
@Column
|
||||
nameDe: string
|
||||
|
||||
@Column
|
||||
nameEn: string
|
||||
|
||||
@Column
|
||||
groupNr: number
|
||||
|
||||
@Column
|
||||
descriptionDe: string
|
||||
|
||||
@Column
|
||||
descriptionEn: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Exercise)
|
||||
exercises: Exercise[]
|
||||
}
|
||||
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[]
|
||||
}
|
||||
46
backend/models/ordering/order.model.ts
Normal file
46
backend/models/ordering/order.model.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Table, Column, Model, BelongsTo, ForeignKey, HasMany, BelongsToMany, Default } from 'sequelize-typescript';
|
||||
import { Account } from '../user/account.model';
|
||||
import { Ticket } from './ticket.model';
|
||||
import { Address } from '../user/address.model';
|
||||
import { Payment } from '../user/payment.model';
|
||||
|
||||
@Table({
|
||||
updatedAt: false,
|
||||
createdAt: 'orderedAt'
|
||||
})
|
||||
export class Order extends Model {
|
||||
@Column
|
||||
@ForeignKey(() => Account)
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
orderedAt: Date
|
||||
|
||||
@ForeignKey(() => Address)
|
||||
@Column
|
||||
addressId: number
|
||||
|
||||
@ForeignKey(() => Payment)
|
||||
@Column
|
||||
paymentId: number
|
||||
|
||||
@Default(false)
|
||||
@Column
|
||||
shipped: boolean
|
||||
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@BelongsTo(() => Address)
|
||||
address: Address
|
||||
|
||||
@BelongsTo(() => Payment)
|
||||
payment: Payment
|
||||
|
||||
@HasMany(() => Ticket)
|
||||
tickets: Ticket[]
|
||||
}
|
||||
33
backend/models/ordering/ticket.model.ts
Normal file
33
backend/models/ordering/ticket.model.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Model, BelongsTo, Column, ForeignKey, HasMany, HasOne, Table } from "sequelize-typescript";
|
||||
import { Concert } from "../acts/concert.model";
|
||||
import { Order } from "./order.model";
|
||||
import { Seat } from "../locations/seat.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Ticket extends Model {
|
||||
@Column
|
||||
@ForeignKey(() => Order)
|
||||
orderId: number
|
||||
|
||||
@Column
|
||||
orderPrice: number
|
||||
|
||||
@Column
|
||||
@ForeignKey(() => Concert)
|
||||
concertId: number
|
||||
|
||||
@Column
|
||||
@ForeignKey(() => Seat)
|
||||
seatId: number
|
||||
|
||||
|
||||
// Relations
|
||||
@BelongsTo(() => Order)
|
||||
order: Order
|
||||
|
||||
@BelongsTo(() => Concert)
|
||||
concert: Concert
|
||||
|
||||
@BelongsTo(() => Seat)
|
||||
seat: Seat
|
||||
}
|
||||
47
backend/models/user/account.model.ts
Normal file
47
backend/models/user/account.model.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey } from 'sequelize-typescript';
|
||||
import { Order } from '../ordering/order.model';
|
||||
import { Address } from './address.model';
|
||||
import { Payment } from './payment.model';
|
||||
import { AccountRole } from './accountRole.model';
|
||||
import { Rating } from '../acts/rating.model';
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Account extends Model {
|
||||
@Unique
|
||||
@Column
|
||||
username: string
|
||||
|
||||
@Column
|
||||
password: string
|
||||
|
||||
@Unique
|
||||
@Column
|
||||
email: string
|
||||
|
||||
@Column
|
||||
firstName: string = ""
|
||||
|
||||
@Column
|
||||
lastName: string = ""
|
||||
|
||||
@ForeignKey(() => AccountRole)
|
||||
@Column
|
||||
accountRoleId: number
|
||||
|
||||
|
||||
// Relations
|
||||
@HasMany(() => Address)
|
||||
addresses: Address[]
|
||||
|
||||
@HasMany(() => Payment)
|
||||
payments: Payment[]
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
|
||||
@HasMany(() => Rating)
|
||||
ratings: Rating[]
|
||||
|
||||
@BelongsTo(() => AccountRole)
|
||||
accountRole: AccountRole
|
||||
}
|
||||
22
backend/models/user/accountRole.model.ts
Normal file
22
backend/models/user/accountRole.model.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class AccountRole extends Model {
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@Column
|
||||
privilegeBuy: boolean
|
||||
|
||||
@Column
|
||||
privilegeAdminPanel: boolean
|
||||
|
||||
@Column
|
||||
privilegeFileAccess: boolean
|
||||
|
||||
|
||||
// Relations
|
||||
@HasMany(() => Account)
|
||||
accounts: Account[]
|
||||
}
|
||||
31
backend/models/user/address.model.ts
Normal file
31
backend/models/user/address.model.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Address extends Model {
|
||||
@ForeignKey(() => Account)
|
||||
@Column
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
street: string
|
||||
|
||||
@Column
|
||||
houseNumber: number
|
||||
|
||||
@Column
|
||||
postalCode: number
|
||||
|
||||
@Column
|
||||
city: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
}
|
||||
25
backend/models/user/payment.model.ts
Normal file
25
backend/models/user/payment.model.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Payment extends Model {
|
||||
@ForeignKey(() => Account)
|
||||
@Column
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
bankName: string
|
||||
|
||||
@Column
|
||||
iban: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
}
|
||||
Reference in New Issue
Block a user