30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
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<TagEntityInterface>;
|
|
|
|
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacterEntityInterface) => workCharacter.interactWith)
|
|
public subjectCharacters!: Promise<WorkCharacterEntityInterface[]>;
|
|
|
|
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacterEntityInterface) => workCharacter.interactedBy)
|
|
public objectCharacters!: Promise<WorkCharacterEntityInterface[]>;
|
|
|
|
@Column('int', {
|
|
nullable: true,
|
|
})
|
|
public weight!: number | null;
|
|
}
|