import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { PercentCheck } from '../decorators/percent-check'; import { Tag } from './tag'; import { WorkCharacter } from './work-character'; @Entity() @PercentCheck('weight') export class InteractionTag implements InteractionTagEntityInterface { @PrimaryGeneratedColumn() public readonly id!: number; @ManyToOne(() => Tag, (tag: TagEntityInterface) => tag.interactionTags, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public tag!: Promise; @ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacterEntityInterface) => workCharacter.interactWith) public subjectCharacters!: Promise; @ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacterEntityInterface) => workCharacter.interactedBy) public objectCharacters!: Promise; @Column('int', { nullable: true, }) public weight!: number | null; }