21 lines
464 B
TypeScript
21 lines
464 B
TypeScript
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
|
import { RefreshToken } from './refresh_token.entity';
|
|
|
|
@Entity()
|
|
export class User {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ unique: true, nullable: false })
|
|
email: string;
|
|
|
|
@Column({ nullable: false })
|
|
name: string;
|
|
|
|
@Column({ nullable: false })
|
|
passwordHash: string;
|
|
|
|
@OneToMany(() => RefreshToken, (token) => token.user)
|
|
refreshTokens: RefreshToken[];
|
|
}
|