import { Work } from './work'; import { WorldCharacter } from './world-character'; import { WorldName } from './world-name'; import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; /** * This entity describes a fictional world. */ @Entity() export class World implements IIdentifiableEntity, IMultiNamedEntity, IHierachicalEntity { @PrimaryGeneratedColumn() public id: number; @Column({ nullable: false, }) public nameCanonical: string; @OneToMany( () => WorldName, (worldName: WorldName) => worldName.entity ) public names: Promise; /** * works taking place in this world */ @ManyToMany( () => Work, (work: Work) => work.worlds ) public works: Promise; /** * canon characters in this world */ @ManyToMany( () => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.worlds ) public worldCharacters: Promise; @ManyToMany( () => World, (world: World) => world.parents ) public children: Promise; @ManyToMany( () => World, (world: World) => world.children ) public parents: Promise; }