Continued updating the code to work with entities better
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
export interface Entity {
|
||||
id: string;
|
||||
label: string;
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: string;
|
||||
entityID: string;
|
||||
permissions: string[];
|
||||
label: string;
|
||||
id: string;
|
||||
entityID: string;
|
||||
permissions: string[];
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface EntityWithRoles extends Entity {
|
||||
roles: Role[];
|
||||
}
|
||||
roles: Role[];
|
||||
};
|
||||
|
||||
export type WithEntity<T> = T extends {entities: {id: string; role: string}[]}
|
||||
? Omit<T, "entities"> & {entities: {entity?: Entity; role?: Role}[]}
|
||||
: T;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user