import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import ArticleEntity from "./article.entity";
import StoreEntity from "./store.entity";

@Entity({name: "article_store"})
export default class ArticleStoreEntity {

    @PrimaryGeneratedColumn()
    id?: number;

    @JoinColumn({name: "id_article"})
    @ManyToOne(type => ArticleEntity)
    article?: ArticleEntity;

    @JoinColumn({name: "id_store"})
    @ManyToOne(type => StoreEntity)
    store?: StoreEntity;

    @Column(
        { type: "datetime", name: "created_at" }
    )
    createdAt?: Date;

    @Column(
        { type: "datetime", name: "updated_at" }
    )
    updatedAt?: Date;

}