Skip to content

Commit

Permalink
feat: fetch a single contract agreement (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
ununhexium authored Aug 7, 2024
1 parent 1ccf89e commit d744703
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ the detailed section referring to by linking pull requests or issues.
- Copyable contact email and subject fields on asset and data offer detail
dialogs
- Assets Page search input field is now case insensitive
- Performance improvement when fetching a single contract agreement
- Temporary reimplement the Edit Asset as a Dialog

## [v4.1.0] - 2024-07-24
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@angular/router": "^14.3.0",
"@ng-apimock/core": "^3.11.0",
"@ngxs/store": "^3.8.1",
"@sovity.de/edc-client": "0.20240719.91939-main-f62d9761",
"@sovity.de/edc-client": "0.20240805.72446-main-4f0ae71b",
"clean-deep": "^3.4.0",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.1",
Expand Down
16 changes: 3 additions & 13 deletions src/app/core/services/api/edc-api.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Inject, Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';
import {
AssetPage,
ConnectorLimits,
Expand Down Expand Up @@ -29,7 +28,7 @@ import {
buildEdcClient,
} from '@sovity.de/edc-client';
import {APP_CONFIG, AppConfig} from '../../config/app-config';
import {throwIfNull, toObservable} from '../../utils/rxjs-utils';
import {toObservable} from '../../utils/rxjs-utils';
import {EDC_FAKE_BACKEND} from './fake-backend/edc-fake-backend';

@Injectable({providedIn: 'root'})
Expand Down Expand Up @@ -179,17 +178,8 @@ export class EdcApiService {
getContractAgreementById(
contractAgreementId: string,
): Observable<ContractAgreementCard> {
return this.getContractAgreementPage({
contractAgreementPageQuery: {terminationStatus: undefined},
}).pipe(
map((page) =>
page.contractAgreements.find(
(it) => it.contractAgreementId === contractAgreementId,
),
),
throwIfNull(
`Contract Agreement with ID ${contractAgreementId} not found`,
),
return toObservable(() =>
this.edcClient.uiApi.getContractAgreementCard({contractAgreementId}),
);
}

Expand Down
8 changes: 8 additions & 0 deletions src/app/core/services/api/fake-backend/edc-fake-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ export const EDC_FAKE_BACKEND: FetchAPI = async (
return ok(ContractAgreementPageToJSON(page));
})

.url('ui/pages/contract-agreement-page/*')
.on('GET', (contractAgreementId: String) => {
return ok(
contractAgreementPage().contractAgreements
.find( (contractAgreement) => contractAgreement.contractAgreementId === contractAgreementId)
);
})

.url('ui/pages/content-agreement-page/*/terminate')
.on('POST', (contractAgreementId) => {
const request = ContractTerminationRequestFromJSON(body);
Expand Down

0 comments on commit d744703

Please sign in to comment.