@@ -4,23 +4,27 @@ import { ResponsePrincipal } from '../responses/ResponsePrincipal';
|
||||
import { Permission } from './Permission';
|
||||
|
||||
/**
|
||||
* Defines a admin user.
|
||||
* Defines the principal entity.
|
||||
* A principal basicly is any entity that can receive permissions for the api (users and their groups).
|
||||
*/
|
||||
@Entity()
|
||||
@TableInheritance({ column: { name: "type", type: "varchar" } })
|
||||
export abstract class Principal {
|
||||
/**
|
||||
* autogenerated unique id (primary key).
|
||||
* Autogenerated unique id (primary key).
|
||||
*/
|
||||
@PrimaryGeneratedColumn()
|
||||
@IsInt()
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* permissions
|
||||
*/
|
||||
* The participant's permissions.
|
||||
*/
|
||||
@OneToMany(() => Permission, permission => permission.principal, { nullable: true })
|
||||
permissions: Permission[];
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
public abstract toResponse(): ResponsePrincipal;
|
||||
}
|
||||
Reference in New Issue
Block a user