ENCOA-273

This commit is contained in:
Tiago Ribeiro
2024-12-11 14:09:10 +00:00
parent d074ec390c
commit eabfcd026b
7 changed files with 144 additions and 97 deletions

View File

@@ -1,31 +1,32 @@
import { RolePermission } from "@/resources/entityPermissions";
export interface Entity {
id: string;
label: string;
id: string;
label: string;
licenses: number
}
export interface Role {
id: string;
entityID: string;
permissions: RolePermission[];
label: string;
isDefault?: boolean
id: string;
entityID: string;
permissions: RolePermission[];
label: string;
isDefault?: boolean
}
export interface EntityWithRoles extends Entity {
roles: Role[];
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;
? 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;
? 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;
? Omit<T, "entities"> & { entities: { entity?: Entity; role?: Role }[] }
: T;