From 5014577d15737994ad5ad8c0fb93739af2dead8c Mon Sep 17 00:00:00 2001 From: marijnritense <94897451+marijnritense@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:11:29 +0100 Subject: [PATCH] Added endpoints for retrieving process document definitions for a document for context-sensitive checks (#1270) * added endpoints for retrieving process document definitions for a document --------- Co-authored-by: teodor-ritense --- projects/valtimo/document/src/lib/models/index.ts | 1 + .../process-document-definition-search.model.ts | 4 ++++ .../document/src/lib/services/document.service.ts | 15 +++++++++++++++ .../dossier-detail/dossier-detail.component.ts | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 projects/valtimo/document/src/lib/models/process-document-definition-search.model.ts diff --git a/projects/valtimo/document/src/lib/models/index.ts b/projects/valtimo/document/src/lib/models/index.ts index 646cc567d..3d37f9d94 100644 --- a/projects/valtimo/document/src/lib/models/index.ts +++ b/projects/valtimo/document/src/lib/models/index.ts @@ -20,3 +20,4 @@ export * from './audit.model'; export * from './advanced-document-search-request'; export * from './document-search-request'; export * from './internal-case-status.model'; +export * from './process-document-definition-search.model'; diff --git a/projects/valtimo/document/src/lib/models/process-document-definition-search.model.ts b/projects/valtimo/document/src/lib/models/process-document-definition-search.model.ts new file mode 100644 index 000000000..bb4a60473 --- /dev/null +++ b/projects/valtimo/document/src/lib/models/process-document-definition-search.model.ts @@ -0,0 +1,4 @@ +export interface ProcessDocumentDefinitionSearch { + startableByUser?: boolean; + canInitializeDocument?: boolean; +} \ No newline at end of file diff --git a/projects/valtimo/document/src/lib/services/document.service.ts b/projects/valtimo/document/src/lib/services/document.service.ts index 31a609901..542321042 100644 --- a/projects/valtimo/document/src/lib/services/document.service.ts +++ b/projects/valtimo/document/src/lib/services/document.service.ts @@ -52,6 +52,7 @@ import { Page, ProcessDocumentDefinition, ProcessDocumentDefinitionRequest, + ProcessDocumentDefinitionSearch, ProcessDocumentInstance, SpecifiedDocuments, TemplatePayload, @@ -306,6 +307,20 @@ export class DocumentService { ); } + public findProcessDocumentDefinitionsForDocument( + documentId: string, + searchRequest: ProcessDocumentDefinitionSearch + ): Observable { + const params = new HttpParams({ + fromObject: searchRequest as any, + }); + console.log({params}); + return this.http.get( + `${this.valtimoEndpointUri}v2/process-document/definition/document/${documentId}`, + {params} + ); + } + public findProcessDocumentDefinitionsByVersion( documentDefinitionName: string, version: number diff --git a/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.ts b/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.ts index 7185b5f1d..c734fc3bb 100644 --- a/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.ts +++ b/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.ts @@ -312,7 +312,7 @@ export class DossierDetailComponent public getAllAssociatedProcessDefinitions(): void { this.documentService - .findProcessDocumentDefinitionsByStartableByUser(this.documentDefinitionName, true) + .findProcessDocumentDefinitionsForDocument(this.documentId, {startableByUser: true}) .subscribe((processDocumentDefinitions: ProcessDocumentDefinition[]) => { this.processDocumentDefinitions = processDocumentDefinitions;