Skip to content

Instantly share code, notes, and snippets.

@vinipachecov
Created May 30, 2020 22:11
Show Gist options
  • Save vinipachecov/9ce59129111b455268e82283e2db2eda to your computer and use it in GitHub Desktop.
Save vinipachecov/9ce59129111b455268e82283e2db2eda to your computer and use it in GitHub Desktop.
Author file for React-Native typeorm setup
import {
Entity,
Column,
PrimaryGeneratedColumn,
OneToMany,
} from 'typeorm/browser';
import { Post } from './post';
@Entity('author')
export class Author {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@Column({ nullable: true })
birthdate: string;
@OneToMany((type: any) => Post, (post) => post.author)
posts: Post[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment