import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; import { User } from '../user/user.entity'; @Entity() export class Document { @PrimaryGeneratedColumn() id: number; @Column({ type: 'text', nullable: false }) title: string; @Column({ type: 'text', nullable: false }) slug: string; @Column({ type: 'text', nullable: false }) body: string; @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP(6)', }) public created_at: Date; @UpdateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP(6)', onUpdate: 'CURRENT_TIMESTAMP(6)', }) public updated_at: Date; @ManyToOne(() => User) author: User; }