Continued creating the entity system

This commit is contained in:
Tiago Ribeiro
2024-10-01 17:39:43 +01:00
parent bae02e5192
commit 564e6438cb
37 changed files with 2522 additions and 130 deletions

View File

@@ -3,14 +3,17 @@ export interface Entity {
label: string;
}
export interface Roles {
export interface Role {
id: string;
entityID: string;
permissions: string[];
label: string;
}
export interface EntityWithPermissions extends Entity {
roles: Roles[];
export interface EntityWithRoles extends Entity {
roles: Role[];
}
export type WithEntity<T> = T extends {entities: string[]} ? T & {entities: Entity[]} : T;
export type WithEntity<T> = T extends {entities: {id: string; role: string}[]}
? Omit<T, "entities"> & {entities: {entity?: Entity; role?: Role}[]}
: T;

View File

@@ -8,5 +8,6 @@ export interface Step {
export interface Grading {
user: string;
entity?: string;
steps: Step[];
}

View File

@@ -1,5 +1,11 @@
import {User} from "./user";
export interface Invite {
id: string;
from: string;
to: string;
id: string;
from: string;
to: string;
}
export interface InviteWithUsers extends Omit<Invite, "from"> {
from?: User;
}

View File

@@ -34,6 +34,7 @@ export interface Assignment {
start?: boolean;
autoStartDate?: Date;
autoStart?: boolean;
entity?: string;
}
export type AssignmentWithCorporateId = Assignment & {corporateId: string};

View File

@@ -22,7 +22,7 @@ export interface BasicUser {
status: UserStatus;
permissions: PermissionType[];
lastLogin?: Date;
entities: string[];
entities: {id: string; role: string}[];
}
export interface StudentUser extends BasicUser {
@@ -150,6 +150,7 @@ export interface Group {
participants: string[];
id: string;
disableEditing?: boolean;
entity?: string;
}
export interface GroupWithUsers extends Omit<Group, "participants" | "admin"> {