Untitled

mail@pastecode.io avatar
unknown
typescript
a year ago
1.4 kB
1
Indexable
Never
@Entity({ name: 'inventories' })
export class Inventory {
  @Expose({ groups: [ADMIN_GROUP] })
  @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true })
  @Generated('increment')
  id: number;

  @Column({ unique: true, default: 'gen_random_uuid()' })
  @Generated('uuid')
  uuid: string;

  @Expose({ groups: [ADMIN_GROUP] })
  @Column({ type: 'bigint', unsigned: true })
  companyId: number;

  @Expose({ groups: [ADMIN_GROUP] })
  @Column({ type: 'bigint', unsigned: true })
  companyBranchId: number;

  @Expose({ groups: [ADMIN_GROUP] })
  @Column({ type: 'bigint', unsigned: true })
  productId: number;

  @Column({ type: 'varchar', enum: InventoryType, length: 255 })
  inventoryType: InventoryType;

  @Column({ type: 'bigint', unsigned: true, nullable: true })
  userId?: number;

  @Column({ type: 'bigint' })
  quantity: number;

  @Column({ type: 'timestamp', default: 'NOW()' })
  createdAt: Date;

  @Column({ type: 'timestamp', default: 'NOW()' })
  updatedAt: Date;

  @Column({ type: 'timestamp', nullable: true })
  deletedAt?: Date;

  @ManyToOne(() => Company, (company) => company.inventories)
  company: Company;

  @ManyToOne(() => CompanyBranch, (companyBranch) => companyBranch.inventories)
  companyBranch: CompanyBranch;

  @ManyToOne(() => Product, (product) => product.inventories)
  product: Product;
}