2020-04-10 04:04:13 +02:00
|
|
|
import { Entity, ManyToMany, PrimaryColumn } from 'typeorm';
|
2020-04-10 05:02:19 +02:00
|
|
|
import { Work } from './work';
|
2019-06-23 02:30:24 +02:00
|
|
|
|
2020-04-10 04:04:13 +02:00
|
|
|
/**
|
|
|
|
* This entity is non-user-maintained and describes a language.
|
|
|
|
*/
|
2019-06-23 02:30:24 +02:00
|
|
|
@Entity()
|
2020-04-10 04:04:13 +02:00
|
|
|
export class Language {
|
|
|
|
/**
|
|
|
|
* ISO 639-1 two-letter language code
|
|
|
|
*/
|
|
|
|
@PrimaryColumn()
|
2020-07-25 02:02:37 +02:00
|
|
|
public code!: string;
|
2019-06-23 02:30:24 +02:00
|
|
|
|
2020-04-10 04:04:13 +02:00
|
|
|
/**
|
|
|
|
* the works using this language
|
|
|
|
*/
|
2020-04-10 05:12:14 +02:00
|
|
|
@ManyToMany(() => Work, (work: Work) => work.languages)
|
2020-07-25 02:02:37 +02:00
|
|
|
public works!: Promise<Work[]>;
|
2019-06-23 02:30:24 +02:00
|
|
|
}
|