Skip to content

Commit

Permalink
Added endpoints for retrieving process document definitions for a doc…
Browse files Browse the repository at this point in the history
…ument for context-sensitive checks (#1270)

* added endpoints for retrieving process document definitions for a document

---------

Co-authored-by: teodor-ritense <[email protected]>
  • Loading branch information
marijnritense and teodor-ritense authored Nov 11, 2024
1 parent b51199f commit 5014577
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions projects/valtimo/document/src/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ProcessDocumentDefinitionSearch {
startableByUser?: boolean;
canInitializeDocument?: boolean;
}
15 changes: 15 additions & 0 deletions projects/valtimo/document/src/lib/services/document.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
Page,
ProcessDocumentDefinition,
ProcessDocumentDefinitionRequest,
ProcessDocumentDefinitionSearch,
ProcessDocumentInstance,
SpecifiedDocuments,
TemplatePayload,
Expand Down Expand Up @@ -306,6 +307,20 @@ export class DocumentService {
);
}

public findProcessDocumentDefinitionsForDocument(
documentId: string,
searchRequest: ProcessDocumentDefinitionSearch
): Observable<ProcessDocumentDefinition[]> {
const params = new HttpParams({
fromObject: searchRequest as any,
});
console.log({params});
return this.http.get<ProcessDocumentDefinition[]>(
`${this.valtimoEndpointUri}v2/process-document/definition/document/${documentId}`,
{params}
);
}

public findProcessDocumentDefinitionsByVersion(
documentDefinitionName: string,
version: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5014577

Please sign in to comment.