forked from eclipse-edc/DataDashboard
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '472-use-new-type-safe-asset-in-ui' of https://github.co…
…m/sovity/edc-ui into 394-use-new-create-contract-definition-endpoint-in-ui # Conflicts: # src/app/core/services/api/edc-api.service.ts # src/app/core/services/api/fake-backend/asset-fake-service.ts # src/app/core/services/api/fake-backend/data/test-assets.ts
- Loading branch information
Showing
6 changed files
with
124 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 30 additions & 24 deletions
54
src/app/core/services/api/fake-backend/data/test-assets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,67 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {AssetCreateRequest} from '@sovity.de/edc-client'; | ||
import {Inject, Injectable} from '@angular/core'; | ||
import {UiAssetCreateRequest} from '@sovity.de/edc-client'; | ||
import {AssetEditorDialogFormValue} from '../../routes/connector-ui/asset-page/asset-create-dialog/asset-editor-dialog-form-model'; | ||
import {AssetPropertyMapper} from './asset-property-mapper'; | ||
import {APP_CONFIG, AppConfig} from '../config/app-config'; | ||
import {DataAddressMapper} from './data-address-mapper'; | ||
|
||
@Injectable() | ||
export class AssetEntryBuilder { | ||
constructor( | ||
private assetPropertyMapper: AssetPropertyMapper, | ||
@Inject(APP_CONFIG) private config: AppConfig, | ||
private dataAddressMapper: DataAddressMapper, | ||
) {} | ||
|
||
/** | ||
* Build {@link AssetCreateRequest} from {@link AssetEditorDialogFormValue} | ||
* Build {@link UiAssetCreateRequest} from {@link AssetEditorDialogFormValue} | ||
* | ||
* @param formValue form value | ||
* @return asset create dto | ||
*/ | ||
buildAssetCreateRequest( | ||
formValue: AssetEditorDialogFormValue, | ||
): AssetCreateRequest { | ||
let properties = this.assetPropertyMapper.buildProperties(formValue); | ||
): UiAssetCreateRequest { | ||
let id = formValue.metadata?.id ?? 'no-id-was-set'; | ||
let name = formValue.metadata?.name; | ||
let version = formValue.metadata?.version; | ||
let description = formValue.metadata?.description; | ||
let language = formValue.metadata?.language?.id; | ||
let keywords = formValue.metadata?.keywords; | ||
let licenseUrl = formValue.metadata?.standardLicense; | ||
let creatorOrganizationName = this.config.curatorOrganizationName; | ||
let publisherHomepage = formValue.metadata?.publisher; | ||
let mediaType = formValue.metadata?.contentType; | ||
|
||
let dataCategory = formValue.advanced?.dataModel; | ||
let dataSubcategory = formValue.advanced?.dataSubcategory?.id; | ||
let transportMode = formValue.advanced?.transportMode?.id; | ||
let geoReferenceMethod = formValue.advanced?.geoReferenceMethod; | ||
let dataModel = formValue.advanced?.dataModel; | ||
|
||
let landingPageUrl = formValue.datasource?.httpUrl; | ||
|
||
const dataAddressProperties = | ||
this.dataAddressMapper.buildDataAddressProperties(formValue.datasource); | ||
return {properties, dataAddressProperties, privateProperties: {}}; | ||
return { | ||
id, | ||
name, | ||
language, | ||
description, | ||
creatorOrganizationName, | ||
publisherHomepage, | ||
licenseUrl, | ||
version, | ||
keywords, | ||
mediaType, | ||
landingPageUrl, | ||
dataCategory, | ||
dataSubcategory, | ||
dataModel, | ||
geoReferenceMethod, | ||
transportMode, | ||
dataAddressProperties, | ||
additionalProperties: {}, | ||
privateProperties: {}, | ||
additionalJsonProperties: {}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters