LocChat/server/entities/user.entity.ts
2021-11-30 15:40:07 -07:00

25 lines
595 B
TypeScript

import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { RefreshToken } from './refresh_token.entity';
import { UserRole } from './user_role.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[];
@OneToMany(() => UserRole, (userRole) => userRole.user)
userRoles: UserRole[];
}