Add organization change-control workflow
This commit is contained in:
@@ -155,13 +155,31 @@ export type OrganizationModel = {
|
||||
function_assignments: OrganizationFunctionAssignmentItem[];
|
||||
};
|
||||
|
||||
export type IdentityOption = {
|
||||
id: string;
|
||||
display_name?: string | null;
|
||||
external_subject?: string | null;
|
||||
source: string;
|
||||
primary_account_id?: string | null;
|
||||
account_ids: string[];
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type IdentityListResponse = {
|
||||
identities: IdentityOption[];
|
||||
};
|
||||
|
||||
export type OrganizationChangeRequestPayload = {
|
||||
change_request_id?: string | null;
|
||||
};
|
||||
|
||||
export type SluggedCreatePayload = {
|
||||
slug?: string | null;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
is_active?: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
};
|
||||
} & OrganizationChangeRequestPayload;
|
||||
|
||||
export type StructureCreatePayload = SluggedCreatePayload & {
|
||||
structure_kind: OrganizationStructureKind;
|
||||
@@ -187,7 +205,7 @@ export type RelationCreatePayload = {
|
||||
target_unit_id: string;
|
||||
is_active?: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
};
|
||||
} & OrganizationChangeRequestPayload;
|
||||
|
||||
export type FunctionTypeCreatePayload = SluggedCreatePayload & {
|
||||
organization_unit_type_id?: string | null;
|
||||
@@ -212,7 +230,7 @@ export type FunctionAssignmentCreatePayload = {
|
||||
acting_for_account_id?: string | null;
|
||||
is_active?: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
};
|
||||
} & OrganizationChangeRequestPayload;
|
||||
|
||||
function post<T, P extends Record<string, unknown>>(settings: ApiSettings, path: string, payload: P): Promise<T> {
|
||||
return apiFetch<T>(settings, path, { method: "POST", body: JSON.stringify(payload) });
|
||||
@@ -226,6 +244,15 @@ export function getOrganizationModel(settings: ApiSettings): Promise<Organizatio
|
||||
return apiFetch<OrganizationModel>(settings, "/api/v1/organizations/model");
|
||||
}
|
||||
|
||||
export async function searchIdentityOptions(settings: ApiSettings, query = "", limit = 25): Promise<IdentityOption[]> {
|
||||
const params = new URLSearchParams();
|
||||
const trimmed = query.trim();
|
||||
if (trimmed) params.set("query", trimmed);
|
||||
params.set("limit", String(limit));
|
||||
const response = await apiFetch<IdentityListResponse>(settings, `/api/v1/identity/identities?${params.toString()}`);
|
||||
return response.identities;
|
||||
}
|
||||
|
||||
export function getOrganizationSettings(settings: ApiSettings): Promise<OrganizationSettingsItem> {
|
||||
return apiFetch<OrganizationSettingsItem>(settings, "/api/v1/organizations/settings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user