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,18 +1,22 @@
import { Table, Column, Model, BelongsTo, ForeignKey, HasMany, BelongsToMany } from 'sequelize-typescript';
import { Table, Column, Model, BelongsTo, ForeignKey, HasMany, BelongsToMany, Default } from 'sequelize-typescript';
import { Account } from './account.model';
import { OrderItem } from './orderItem.model';
@Table
@Table({
updatedAt: false,
createdAt: 'orderedAt'
})
export class Order extends Model {
@Column
@ForeignKey(() => Account)
accountId: number
@Column
totalPrice: number
orderedAt: Date
@Default(1)
@Column
shippingProgress: number = 1
shippingProgress: number
// Relations
@@ -20,5 +24,5 @@ export class Order extends Model {
account: Account
@HasMany(() => OrderItem)
orderItem: OrderItem[]
orderItems: OrderItem[]
}