Start moving data server handling from pinia store to server

This commit is contained in:
2024-10-03 19:03:36 +02:00
parent 2cbee721c7
commit 2b7e87a68d
27 changed files with 401 additions and 215 deletions

View File

@@ -2,7 +2,7 @@ import { BelongsTo, BelongsToMany, Column, DataType, ForeignKey, HasMany, Model,
import { Member } from "./member.model";
import { Genre } from "./genre.model";
import { Rating } from "./rating.model";
import { Tour } from "./tour.model";
import { Event } from "./event.model";
import { BandGenre } from "./bandGenre.model";
@Table({ timestamps: false })
@@ -45,8 +45,8 @@ export class Band extends Model {
@HasMany(() => Rating)
ratings: Rating[]
@HasMany(() => Tour)
tours: Tour[]
@HasMany(() => Event)
events: Event[]
@BelongsToMany(() => Genre, () => BandGenre)
genres: Genre[]

View File

@@ -1,7 +1,7 @@
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
import { Location } from "./../locations/location.model";
import { Tour } from "./tour.model";
import { OrderItem } from "../ordering/orderItem.model";
import { Event } from "./event.model";
import { Ticket } from "../ordering/ticket.model";
@Table({ timestamps: false })
export class Concert extends Model {
@@ -18,18 +18,19 @@ export class Concert extends Model {
@Column
locationId: Number
@ForeignKey(() => Tour)
tourId: Number
@ForeignKey(() => Event)
@Column
eventId: Number
// Relations
@BelongsTo(() => Tour)
tour: Tour
@BelongsTo(() => Event)
event: Event
@BelongsTo(() => Location)
location: Location
@HasMany(() => OrderItem)
orderItems: OrderItem[]
@HasMany(() => Ticket)
tickets: Ticket[]
}

View File

@@ -3,7 +3,7 @@ import { Band } from "./band.model";
import { Concert } from "./concert.model";
@Table({ timestamps: false })
export class Tour extends Model {
export class Event extends Model {
@Column
name: String

View File

@@ -1,6 +1,6 @@
import { Table, Column, Model, BelongsTo, ForeignKey, HasMany, BelongsToMany, Default } from 'sequelize-typescript';
import { Account } from '../user/account.model';
import { OrderItem } from './orderItem.model';
import { Ticket } from './ticket.model';
import { Address } from '../user/address.model';
import { Payment } from '../user/payment.model';
@@ -40,6 +40,6 @@ export class Order extends Model {
@BelongsTo(() => Payment)
payment: Payment
@HasMany(() => OrderItem)
orderItems: OrderItem[]
@HasMany(() => Ticket)
tickets: Ticket[]
}

View File

@@ -1,22 +1,24 @@
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 OrderItem extends Model {
export class Ticket extends Model {
@Column
@ForeignKey(() => Order)
orderId: number
@Column
quantity: number
@Column
orderPrice: number
@Column
@ForeignKey(() => Concert)
showId: number
concertId: number
@Column
@ForeignKey(() => Seat)
seatId: number
// Relations
@@ -25,4 +27,7 @@ export class OrderItem extends Model {
@BelongsTo(() => Concert)
product: Concert
@BelongsTo(() => Seat)
seat: Seat
}