LocChat/server/entities/role.entity.ts
Joseph Ditton 84b45cd6b1 adds roles
2021-12-01 20:18:26 -07:00

23 lines
475 B
TypeScript

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