Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: data address built wrongly #345

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ the detailed section referring to by linking pull requests or issues.

#### Fixed

## [v0.0.1-milestone-8-sovity10] 07.07.2023

### Overview

Bugfix Release

### Detailed Changes

#### Fixed

- Fixed a bug causing data address dtos to be built wrongly.

## [v0.0.1-milestone-8-sovity9] 04.07.2023

### Overview
Expand Down
3 changes: 2 additions & 1 deletion src/app/core/services/data-address-mapper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Injectable} from '@angular/core';
import {AssetDatasourceFormValue} from '../../routes/connector-ui/asset-page/asset-create-dialog/model/asset-datasource-form-model';
import {ContractAgreementTransferDialogFormValue} from '../../routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form-model';
import {DataAddressDto} from './api/legacy-managent-api-client';
import {HttpRequestParamsMapper} from './http-params-mapper.service';

@Injectable({providedIn: 'root'})
Expand All @@ -12,7 +13,7 @@ export class DataAddressMapper {
| AssetDatasourceFormValue
| ContractAgreementTransferDialogFormValue
| undefined,
): Record<string, string> {
): DataAddressDto {
switch (formValue?.dataAddressType) {
case 'Custom-Data-Address-Json':
return JSON.parse(formValue.dataDestination?.trim()!!);
Expand Down
5 changes: 3 additions & 2 deletions src/app/core/services/http-params-mapper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {HttpDatasourceQueryParamFormValue} from '../../routes/connector-ui/asset
import {ContractAgreementTransferDialogFormValue} from '../../routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form-model';
import {removeNullValues} from '../utils/record-utils';
import {everythingAfter, everythingBefore} from '../utils/string-utils';
import {DataAddressDto} from './api/legacy-managent-api-client';
import {Asset} from './models/asset';
import {HttpRequestParams} from './models/http-request-params';

Expand All @@ -15,9 +16,9 @@ export class HttpRequestParamsMapper {
| AssetDatasourceFormValue
| ContractAgreementTransferDialogFormValue
| undefined,
): Record<string, string> {
): DataAddressDto {
const params = this.buildHttpRequestParams(formValue);
return this.encodeHttpRequestParams(params);
return {properties: this.encodeHttpRequestParams(params)};
}

encodeHttpProxyTransferRequestProperties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ <h1 mat-dialog-title>Create New Asset</h1>
<mat-label>Custom Datasource Config (JSON)</mat-label>
<textarea
matInput
placeholder='{"type": "HttpData", ...}'
placeholder='{"properties": {"type": "HttpData", ...}}'
[formControl]="ctrl"></textarea>
<mat-error *ngIf="ctrl.invalid && ctrl.errors?.jsonInvalid">
{{ validationMessages.invalidJsonMessage }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1 mat-dialog-title>Initiate Transfer</h1>
<mat-label>Custom Datasink Config (JSON)</mat-label>
<textarea
matInput
placeholder='{"type": "HttpData", ...}'
placeholder='{"properties": {"type": "HttpData", ...}}'
[formControl]="ctrl"></textarea>
<mat-error *ngIf="ctrl.invalid && ctrl.errors?.jsonInvalid">
{{ validationMessages.invalidJsonMessage }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy {
value,
);

let dataAddressProperties =
this.dataAddressMapper.buildDataAddressProperties(value);
let dataSinkProperties =
this.dataAddressMapper.buildDataAddressProperties(value).properties ?? {};

return {
type: 'PARAMS_ONLY',
params: {
contractAgreementId: this.data.contractId,
properties: transferRequestProperties,
dataSinkProperties: dataAddressProperties,
dataSinkProperties,
},
};
}
Expand Down