import { Column, Entity, JoinTable, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import { Work } from './work'; import { WorldCharacter } from './world-character'; import { WorldName } from './world-name'; /** * This entity describes a fictional world. */ @Entity() export class World implements IdentifiableEntityInterface, MultiNamedEntityInterface, HierarchicalEntityInterface { @PrimaryGeneratedColumn() public id!: number; @Column({ nullable: false, default: '', }) 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) @JoinTable() public worldCharacters!: Promise; @ManyToMany(() => World, (world: World) => world.parents) public children!: Promise; @ManyToMany(() => World, (world: World) => world.children) @JoinTable() public parents!: Promise; }