feat: allow multiple works per work character
BREAKING CHANGE: This commit replaces the initial typeorm migration.
This commit is contained in:
parent
bbc04d4467
commit
40618ce65c
|
@ -1,4 +1,4 @@
|
||||||
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Entity, JoinTable, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { CharacterTag } from './character-tag';
|
import { CharacterTag } from './character-tag';
|
||||||
import { InteractionTag } from './interaction-tag';
|
import { InteractionTag } from './interaction-tag';
|
||||||
import { Work } from './work';
|
import { Work } from './work';
|
||||||
|
@ -23,14 +23,11 @@ export class WorkCharacter implements IIdentifiableEntity, IMultiNamedEntity {
|
||||||
public names!: Promise<WorkCharacterName[]>;
|
public names!: Promise<WorkCharacterName[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the work the character is a part of
|
* the works the character is a part of
|
||||||
|
* one work character can be part of multiple works because of series
|
||||||
*/
|
*/
|
||||||
@ManyToOne(() => Work, (work: Work) => work.workCharacters, {
|
@ManyToMany(() => Work, (work: Work) => work.workCharacters)
|
||||||
nullable: false,
|
public works!: Promise<Work[]>;
|
||||||
onDelete: 'CASCADE',
|
|
||||||
onUpdate: 'CASCADE',
|
|
||||||
})
|
|
||||||
public work!: Promise<Work>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* interaction with other characters as actor
|
* interaction with other characters as actor
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
|
||||||
/**
|
/**
|
||||||
* characters in this work
|
* characters in this work
|
||||||
*/
|
*/
|
||||||
@OneToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.work)
|
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.works)
|
||||||
public workCharacters!: Promise<WorkCharacter[]>;
|
public workCharacters!: Promise<WorkCharacter[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<mxfile
|
<mxfile
|
||||||
modified="2020-04-10T01:22:08.923Z"
|
modified="2020-08-08T16:51:52.280Z"
|
||||||
host="Electron"
|
host="Electron"
|
||||||
agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.9.9 Chrome/80.0.3987.163 Electron/8.2.1 Safari/537.36"
|
agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/13.5.7 Chrome/83.0.4103.122 Electron/9.1.2 Safari/537.36"
|
||||||
etag="td56KXHfCoersQbMeEo0"
|
etag="8cyIrKWiNQ4HlMxaFiU2"
|
||||||
version="12.9.9"
|
version="13.5.7"
|
||||||
type="device"
|
type="device"
|
||||||
>
|
>
|
||||||
<diagram id="7pO8vZOzMzqqcNqUb2yP" name="Library">
|
<diagram id="7pO8vZOzMzqqcNqUb2yP" name="Library">
|
||||||
<mxGraphModel
|
<mxGraphModel
|
||||||
dx="4478"
|
dx="4120"
|
||||||
dy="1748"
|
dy="1701"
|
||||||
grid="1"
|
grid="1"
|
||||||
gridSize="10"
|
gridSize="10"
|
||||||
guides="1"
|
guides="1"
|
||||||
|
@ -1251,7 +1251,7 @@
|
||||||
<mxCell
|
<mxCell
|
||||||
id="cxYTDXOgWw0TtGYY2s0I-85"
|
id="cxYTDXOgWw0TtGYY2s0I-85"
|
||||||
value=""
|
value=""
|
||||||
style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERone;startFill=0;endFill=0;"
|
style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERoneToMany;startFill=0;endFill=0;"
|
||||||
parent="pIilZBVu6Sjv9dfcfJZ6-1"
|
parent="pIilZBVu6Sjv9dfcfJZ6-1"
|
||||||
source="N6cZQSpIyY3U0Nj-7UmH-37"
|
source="N6cZQSpIyY3U0Nj-7UmH-37"
|
||||||
target="cxYTDXOgWw0TtGYY2s0I-81"
|
target="cxYTDXOgWw0TtGYY2s0I-81"
|
||||||
|
|
Loading…
Reference in New Issue