import { Entity , Column , PrimaryGeneratedColumn , OneToMany , CreateDateColumn , UpdateDateColumn } from 'typeorm' ; import Post from '../post/post.entity' ; @ Entity ( ) class Author { @ PrimaryGeneratedColumn ( ) id : number ; @ Column ( ) firstname : string ; @ Column ( ) lastname : string ; @ OneToMany ( type => Post , post => post . author ) posts : Post [ ] ; @ CreateDateColumn ( ) created_at : Date ; @ UpdateDateColumn ( ) updated_at : Date ; } export default Author ;