blob: da3372665ef4c0f5f5183a8d7c49b9de6c9b54a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import { Entity, PrimaryGeneratedColumn, OneToMany, Column } from 'typeorm';
import { UserRole } from './user_role.entity';
// Make sure to add aditional roles here then reseed
export enum RoleKey {
ADMIN = 'admin',
USER = 'user',
}
@Entity()
export class Role {
static ROLES = [RoleKey.ADMIN, RoleKey.USER];
@PrimaryGeneratedColumn()
id: number;
@Column()
key: RoleKey;
@OneToMany(() => UserRole, (userRole) => userRole.role)
userRoles: UserRole[];
}
|