Skip to content

Commit

Permalink
fix: data address built wrongly
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtreier committed Jul 7, 2023
1 parent 8d364c3 commit 5b6d4dc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
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

0 comments on commit 5b6d4dc

Please sign in to comment.