Extend database with more tables, rewrite API doc, improve API endpoints

This commit is contained in:
2024-09-23 21:22:45 +02:00
parent 6aae064902
commit 87f3516b54
41 changed files with 1345 additions and 1126 deletions

View File

@@ -1,7 +1,10 @@
import { Table, Column, Model, HasMany, Unique } from 'sequelize-typescript';
import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey } from 'sequelize-typescript';
import { Order } from './order.model';
import { Address } from './address.model';
import { Payment } from './payment.model';
import { AccountRole } from './accountRole.model';
@Table
@Table({ timestamps: false })
export class Account extends Model {
@Unique
@Column
@@ -16,25 +19,21 @@ export class Account extends Model {
@Column
lastName: string = ""
@ForeignKey(() => AccountRole)
@Column
street: string = ""
accountRoleId: number
@Column
houseNumber: number = 0
@Column
postalCode: number = 0
@Column
city: string
@Column
bankName: string
@Column
iban: string
// Relations
@HasMany(() => Address)
addresses: Address[]
@HasMany(() => Payment)
payments: Payment[]
@HasMany(() => Order)
orders: Order[]
@BelongsTo(() => AccountRole)
accountRole: AccountRole
}