import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';
import { CoreEntity } from './core/core-entity';
import { Product } from './product.entity';

@Entity('publist-histories')
export class PublistHistory extends CoreEntity {
  @Column({ type: 'varchar', nullable: true, default: null })
  error: string;

  @Column({ type: 'varchar', nullable: true, default: null })
  message: string;

  @Column({ type: 'bool' })
  published: boolean;

  @ManyToOne(() => Product, (product) => product.histories, {
    onDelete: 'CASCADE', // hoặc 'SET NULL' tùy mục đích
  })
  product: Product;
}
