blob: c3ece9698a2cbf138287b3f5f0c11ed456cd21cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { ChatRoom } from './chat_room.entity';
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 })
firstName: string;
@Column({ nullable: false })
lastName: string;
@Column({ nullable: false })
passwordHash: string;
@OneToMany(() => RefreshToken, (token) => token.user)
refreshTokens: RefreshToken[];
@OneToMany(() => UserRole, (userRole) => userRole.user, { cascade: true })
userRoles: UserRole[];
@OneToMany(() => ChatRoom, (chatRoom) => chatRoom.user)
chatRooms: ChatRoom[];
}
|