summaryrefslogtreecommitdiff
path: root/server/entities/role.entity.ts
diff options
context:
space:
mode:
authorJoseph Ditton <jditton.atomic@gmail.com>2021-12-01 20:18:26 -0700
committerJoseph Ditton <jditton.atomic@gmail.com>2021-12-01 20:18:26 -0700
commit84b45cd6b11347e66437cd92dc20372d0abd6eb9 (patch)
tree6e42b5861278485c67159dc57c225983e3fd69f8 /server/entities/role.entity.ts
parentd803aaaf1be441f55fe674c3b0c6793e77a9203f (diff)
downloadlocchat-84b45cd6b11347e66437cd92dc20372d0abd6eb9.tar.gz
locchat-84b45cd6b11347e66437cd92dc20372d0abd6eb9.zip
adds roles
Diffstat (limited to 'server/entities/role.entity.ts')
-rw-r--r--server/entities/role.entity.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/entities/role.entity.ts b/server/entities/role.entity.ts
index 35b4ac3..da33726 100644
--- a/server/entities/role.entity.ts
+++ b/server/entities/role.entity.ts
@@ -1,20 +1,21 @@
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 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];
+ static ROLES = [RoleKey.ADMIN, RoleKey.USER];
@PrimaryGeneratedColumn()
id: number;
@Column()
- key: string;
+ key: RoleKey;
@OneToMany(() => UserRole, (userRole) => userRole.role)
userRoles: UserRole[];