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[]; }