Add scoped postbox template previews
This commit is contained in:
@@ -114,6 +114,8 @@ export type PostboxGrouping = {
|
||||
name: string;
|
||||
is_default: boolean;
|
||||
postbox_ids: string[];
|
||||
total_count: number;
|
||||
unread_count: number;
|
||||
resource_revision: number;
|
||||
etag: string;
|
||||
created_at: string;
|
||||
@@ -192,6 +194,8 @@ export type PostboxTemplateRevision = {
|
||||
function_type_id?: string | null;
|
||||
scope_kind: "tenant" | "unit" | "subtree" | "unit_type";
|
||||
scope_id?: string | null;
|
||||
scope_structure_id?: string | null;
|
||||
scope_relation_type_ids: string[];
|
||||
name_pattern: string;
|
||||
address_pattern: string;
|
||||
classification: string;
|
||||
@@ -225,6 +229,8 @@ export type PostboxTemplateRevisionPayload = Pick<
|
||||
| "function_type_id"
|
||||
| "scope_kind"
|
||||
| "scope_id"
|
||||
| "scope_structure_id"
|
||||
| "scope_relation_type_ids"
|
||||
| "name_pattern"
|
||||
| "address_pattern"
|
||||
| "classification"
|
||||
@@ -238,6 +244,31 @@ export type PostboxTemplateCreatePayload = PostboxTemplateRevisionPayload & {
|
||||
description?: string | null;
|
||||
};
|
||||
|
||||
export type PostboxTemplatePreviewTarget = {
|
||||
organization_unit_id: string;
|
||||
organization_unit_name: string;
|
||||
function_id: string;
|
||||
function_name: string;
|
||||
address: string;
|
||||
name: string;
|
||||
holder_count: number;
|
||||
vacant: boolean;
|
||||
status: string;
|
||||
existing_postbox_id?: string | null;
|
||||
diagnostics: string[];
|
||||
};
|
||||
|
||||
export type PostboxTemplatePreview = {
|
||||
targets: PostboxTemplatePreviewTarget[];
|
||||
total: number;
|
||||
ready_count: number;
|
||||
existing_count: number;
|
||||
vacant_count: number;
|
||||
blocked_count: number;
|
||||
truncated: boolean;
|
||||
diagnostics: string[];
|
||||
};
|
||||
|
||||
export type PostboxExactCreatePayload = {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
@@ -435,6 +466,21 @@ export function createPostboxTemplate(
|
||||
return apiPostJson(settings, "/api/v1/postbox/admin/templates", payload);
|
||||
}
|
||||
|
||||
export function previewPostboxTemplate(
|
||||
settings: ApiSettings,
|
||||
payload: PostboxTemplateCreatePayload & {
|
||||
template_id?: string | null;
|
||||
context_key?: string | null;
|
||||
limit?: number;
|
||||
}
|
||||
): Promise<PostboxTemplatePreview> {
|
||||
return apiPostJson(
|
||||
settings,
|
||||
"/api/v1/postbox/admin/templates/preview",
|
||||
payload
|
||||
);
|
||||
}
|
||||
|
||||
export function revisePostboxTemplate(
|
||||
settings: ApiSettings,
|
||||
template: PostboxTemplate,
|
||||
|
||||
Reference in New Issue
Block a user