import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, CreateDateColumn, Unique, } from 'typeorm'; import { Character } from '../../character/entities/character.entity'; import { Spell } from './spell.entity'; @Entity('player_spells') @Unique(['characterId', 'spellId']) export class PlayerSpell { @PrimaryGeneratedColumn('uuid') id: string; @Column({ name: 'character_id' }) characterId: string; @ManyToOne(() => Character) @JoinColumn({ name: 'character_id' }) character: Character; @Column({ name: 'spell_id' }) spellId: string; @ManyToOne(() => Spell) @JoinColumn({ name: 'spell_id' }) spell: Spell; @CreateDateColumn({ name: 'unlocked_at' }) unlockedAt: Date; }