Add ToursTable, update API documentation
This commit is contained in:
@@ -2,6 +2,7 @@ import { BelongsTo, Column, DataType, ForeignKey, HasMany, Model, Table } from "
|
||||
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 {
|
||||
@@ -44,6 +45,9 @@ export class Band extends Model {
|
||||
@HasMany(() => Rating)
|
||||
ratings: Rating[]
|
||||
|
||||
@HasMany(() => Tour)
|
||||
tours: Tour[]
|
||||
|
||||
@BelongsTo(() => Genre)
|
||||
genre: Genre
|
||||
}
|
||||
17
software/backend/models/acts/city.model.ts
Normal file
17
software/backend/models/acts/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[]
|
||||
}
|
||||
28
software/backend/models/acts/location.model.ts
Normal file
28
software/backend/models/acts/location.model.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Show } from "./show.model";
|
||||
import { City } from "./city.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Location extends Model {
|
||||
@Column
|
||||
name: String
|
||||
|
||||
@Column
|
||||
address: String
|
||||
|
||||
@ForeignKey(() => City)
|
||||
@Column
|
||||
cityId: Number
|
||||
|
||||
@Column
|
||||
image: String
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Show)
|
||||
shows: Show[]
|
||||
|
||||
@BelongsTo(() => City)
|
||||
city: City
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Account } from "../user/account.model";
|
||||
import { Band } from "./band.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
@@ -1,15 +1,10 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { Band } from "./band.model";
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Location } from "./location.model";
|
||||
import { Tour } from "./tour.model";
|
||||
import { OrderItem } from "../ordering/orderItem.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Show extends Model {
|
||||
@Column
|
||||
name: String
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
bandId: Number
|
||||
|
||||
@Column
|
||||
date: String
|
||||
|
||||
@@ -19,19 +14,22 @@ export class Show extends Model {
|
||||
@Column
|
||||
inStock: Number
|
||||
|
||||
@Column
|
||||
offered: Boolean
|
||||
|
||||
@ForeignKey(() => Location)
|
||||
@Column
|
||||
locationId: Number
|
||||
|
||||
@ForeignKey(() => Tour)
|
||||
tourId: Number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Band)
|
||||
band: Band
|
||||
@BelongsTo(() => Tour)
|
||||
tour: Tour
|
||||
|
||||
@BelongsTo(() => Location)
|
||||
location: Location
|
||||
|
||||
@HasMany(() => OrderItem)
|
||||
orderItems: OrderItem[]
|
||||
}
|
||||
24
software/backend/models/acts/tour.model.ts
Normal file
24
software/backend/models/acts/tour.model.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Band } from "./band.model";
|
||||
import { Show } from "./show.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Tour extends Model {
|
||||
@Column
|
||||
name: String
|
||||
|
||||
@ForeignKey(() => Band)
|
||||
bandId: Number
|
||||
|
||||
@Column
|
||||
offered: Boolean
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Band)
|
||||
band: Band
|
||||
|
||||
@HasMany(() => Show)
|
||||
shows: Show[]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Column, Model, Table } from "sequelize-typescript";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Location extends Model {
|
||||
@Column
|
||||
name: String
|
||||
|
||||
@Column
|
||||
address: String
|
||||
|
||||
@Column
|
||||
image: String
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Table, Column, Model, BelongsTo, ForeignKey, HasMany, BelongsToMany, Default } from 'sequelize-typescript';
|
||||
import { Account } from './account.model';
|
||||
import { Account } from '../user/account.model';
|
||||
import { OrderItem } from './orderItem.model';
|
||||
import { Address } from './address.model';
|
||||
import { Payment } from './payment.model';
|
||||
import { Address } from '../user/address.model';
|
||||
import { Payment } from '../user/payment.model';
|
||||
|
||||
@Table({
|
||||
updatedAt: false,
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Model, BelongsTo, Column, ForeignKey, HasMany, HasOne, Table } from "sequelize-typescript";
|
||||
import { Show } from "./show.model";
|
||||
import { Show } from "../acts/show.model";
|
||||
import { Order } from "./order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
@@ -16,7 +16,7 @@ export class OrderItem extends Model {
|
||||
|
||||
@Column
|
||||
@ForeignKey(() => Show)
|
||||
productId: number
|
||||
showId: number
|
||||
|
||||
|
||||
// Relations
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey } from 'sequelize-typescript';
|
||||
import { Order } from './order.model';
|
||||
import { Order } from '../ordering/order.model';
|
||||
import { Address } from './address.model';
|
||||
import { Payment } from './payment.model';
|
||||
import { AccountRole } from './accountRole.model';
|
||||
import { Rating } from './rating.model';
|
||||
import { Rating } from '../acts/rating.model';
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Account extends Model {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "./order.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Address extends Model {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "./order.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Payment extends Model {
|
||||
Reference in New Issue
Block a user