Files
fivem/src/server/entities/business-stock-level.entity.ts

32 lines
843 B
TypeScript

import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
import { PropertyEntity } from './property.entity';
import { ItemTypeEntity } from './item-type.entity';
@Entity('business_stock_levels')
@Unique(['property_id', 'item_type_id'])
export class BusinessStockLevelEntity {
@PrimaryGeneratedColumn()
id: number;
@Index()
@Column()
property_id: number;
@Column()
item_type_id: number;
@Column({ type: 'int', default: 0 })
quantity: number;
@Column({ type: 'int', default: 0 })
min_threshold: number;
@ManyToOne(() => PropertyEntity, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'property_id' })
property: PropertyEntity;
@ManyToOne(() => ItemTypeEntity)
@JoinColumn({ name: 'item_type_id' })
itemType: ItemTypeEntity;
}