Created a new system for the Groups that will persist after having entities
This commit is contained in:
16
src/interfaces/entity.ts
Normal file
16
src/interfaces/entity.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface Entity {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Roles {
|
||||
id: string;
|
||||
permissions: string[];
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface EntityWithPermissions extends Entity {
|
||||
roles: Roles[];
|
||||
}
|
||||
|
||||
export type WithEntity<T> = T extends {entities: string[]} ? T & {entities: Entity[]} : T;
|
||||
@@ -22,6 +22,7 @@ export interface BasicUser {
|
||||
status: UserStatus;
|
||||
permissions: PermissionType[];
|
||||
lastLogin?: Date;
|
||||
entities: string[];
|
||||
}
|
||||
|
||||
export interface StudentUser extends BasicUser {
|
||||
@@ -151,6 +152,11 @@ export interface Group {
|
||||
disableEditing?: boolean;
|
||||
}
|
||||
|
||||
export interface GroupWithUsers extends Omit<Group, "participants" | "admin"> {
|
||||
admin: User;
|
||||
participants: User[];
|
||||
}
|
||||
|
||||
export interface Code {
|
||||
id: string;
|
||||
code: string;
|
||||
@@ -165,4 +171,6 @@ export interface Code {
|
||||
}
|
||||
|
||||
export type Type = "student" | "teacher" | "corporate" | "admin" | "developer" | "agent" | "mastercorporate";
|
||||
export const userTypes: Type[] = ["student", "teacher", "corporate", "admin", "developer", "agent", "mastercorporate"];
|
||||
export const userTypes: Type[] = ["student", "teacher", "corporate", "admin", "developer", "agent", "mastercorporate"];
|
||||
|
||||
export type WithUser<T> = T extends {participants: string[]} ? Omit<T, "participants"> & {participants: User[]} : T;
|
||||
|
||||
Reference in New Issue
Block a user