Merge with develop
This commit is contained in:
31
src/interfaces/entity.ts
Normal file
31
src/interfaces/entity.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { RolePermission } from "@/resources/entityPermissions";
|
||||
|
||||
export interface Entity {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: string;
|
||||
entityID: string;
|
||||
permissions: RolePermission[];
|
||||
label: string;
|
||||
isDefault?: boolean
|
||||
}
|
||||
|
||||
export interface EntityWithRoles extends Entity {
|
||||
roles: Role[];
|
||||
};
|
||||
|
||||
export type WithLabeledEntities<T> = T extends { entities: { id: string; role: string }[] }
|
||||
? Omit<T, "entities"> & { entities: { id: string; label?: string; role: string, roleLabel?: string }[] }
|
||||
: T;
|
||||
|
||||
|
||||
export type WithEntity<T> = T extends { entity?: string }
|
||||
? Omit<T, "entity"> & { entity: Entity }
|
||||
: T;
|
||||
|
||||
export type WithEntities<T> = T extends { entities: { id: string; role: string }[] }
|
||||
? Omit<T, "entities"> & { entities: { entity?: Entity; role?: Role }[] }
|
||||
: T;
|
||||
@@ -8,5 +8,6 @@ export interface Step {
|
||||
|
||||
export interface Grading {
|
||||
user: string;
|
||||
entity?: string;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { Entity } from "./entity";
|
||||
|
||||
export interface Invite {
|
||||
id: string;
|
||||
from: string;
|
||||
to: string;
|
||||
id: string;
|
||||
entity: string;
|
||||
from: string
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface InviteWithEntity extends Omit<Invite, "entity"> {
|
||||
entity?: Entity;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface Assignment {
|
||||
start?: boolean;
|
||||
autoStartDate?: Date;
|
||||
autoStart?: boolean;
|
||||
entity?: string;
|
||||
}
|
||||
|
||||
export type AssignmentWithCorporateId = Assignment & {corporateId: string};
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface BasicUser {
|
||||
status: UserStatus;
|
||||
permissions: PermissionType[];
|
||||
lastLogin?: Date;
|
||||
entities: {id: string; role: string}[];
|
||||
}
|
||||
|
||||
export interface StudentUser extends BasicUser {
|
||||
@@ -149,6 +150,12 @@ export interface Group {
|
||||
participants: string[];
|
||||
id: string;
|
||||
disableEditing?: boolean;
|
||||
entity?: string;
|
||||
}
|
||||
|
||||
export interface GroupWithUsers extends Omit<Group, "participants" | "admin"> {
|
||||
admin: User;
|
||||
participants: User[];
|
||||
}
|
||||
|
||||
export interface Code {
|
||||
@@ -165,4 +172,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