16 lines
398 B
TypeScript
16 lines
398 B
TypeScript
import { Entity, ManyToMany, PrimaryColumn } from 'typeorm';
|
|
import { Work } from './work';
|
|
|
|
@Entity()
|
|
export class Language implements LanguageEntityInterface {
|
|
@PrimaryColumn()
|
|
public readonly code!: LangCode;
|
|
|
|
@ManyToMany(() => Work, (work: WorkEntityInterface) => work.languages)
|
|
public works!: Promise<WorkEntityInterface[]>;
|
|
|
|
public get id(): LangCode {
|
|
return this.code;
|
|
}
|
|
}
|