Files
back/src/words/entities/word.entity.ts
T

29 lines
471 B
TypeScript

import { User } from 'src/users/entities/user.entity';
import {
Column,
Entity,
JoinTable,
ManyToMany,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
Unique,
} from 'typeorm';
import { Topic } from './topic.entity';
@Entity()
export class Word {
@PrimaryGeneratedColumn()
id: number;
@Column()
value: string;
@ManyToOne((type) => User)
owner: User;
@ManyToMany((type) => Topic, (topic) => topic.words)
@JoinTable()
topics: Topic[];
}