summaryrefslogtreecommitdiff
path: root/server/entities/role.entity.ts
blob: 35b4ac3ddcf4373c0a158e5652aac00f901e2018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Entity, PrimaryGeneratedColumn, OneToMany, Column } from 'typeorm';
import { UserRole } from './user_role.entity';

@Entity()
export class Role {
  static ADMIN = 'admin';
  static USER = 'user';

  // make sure add additional roles to this arraylist as it
  // will be used during seeds to initiallize all roles.
  static ROLES = [Role.ADMIN, Role.USER];

  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  key: string;

  @OneToMany(() => UserRole, (userRole) => userRole.role)
  userRoles: UserRole[];
}