Skip to content

Instantly share code, notes, and snippets.

@rkkautsar
Created March 20, 2018 16:26
Show Gist options
  • Save rkkautsar/45175ff9685fdc88317f109c36a1f7e3 to your computer and use it in GitHub Desktop.
Save rkkautsar/45175ff9685fdc88317f109c36a1f7e3 to your computer and use it in GitHub Desktop.
import { Entity, Column, ManyToOne, OneToMany } from 'typeorm';
import { BaseEntity } from './BaseEntity';
import { Project } from './Project';
import { Task } from './Task';
@Entity()
export class List extends BaseEntity {
@Column('varchar') name!: string;
@ManyToOne(type => Project, project => project.lists)
project!: Project;
@OneToMany(type => Task, task => task.list)
tasks!: Task[];
}
import { Entity, Column, ManyToOne, OneToMany } from 'typeorm';
import { BaseEntity } from './BaseEntity';
import { List } from './List';
import { TaskMutation } from './TaskMutation';
@Entity()
export class Task extends BaseEntity {
@Column('varchar') title!: string;
@Column('varchar', { nullable: true })
assignee!: string;
@ManyToOne(type => List, list => list.tasks)
list!: List;
@OneToMany(type => TaskMutation, mutation => mutation.task)
mutations!: TaskMutation[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment