From: Arundathi Patil Date: Wed, 17 Jul 2019 17:02:44 +0000 (+0530) Subject: loopback Api- get Sources list X-Git-Tag: 0.5.0~55^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=3dd38ac3051a80adcbdb70cfb1c3550b6c507506;p=ccsdk%2Fcds.git loopback Api- get Sources list Implemented api to fetch source list from backend Issue-ID: CCSDK-707 Change-Id: Ica7a3177f7a426456d921474a7758d2745eae33f Signed-off-by: Arundathi Patil --- diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts index 486c28658..63587e6b3 100644 --- a/cds-ui/server/src/controllers/data-dictionary.controller.ts +++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts @@ -84,4 +84,15 @@ export class DataDictionaryController { }) resourceDictionaryList: JSON): Promise { return await this.rdservice.searchbyNames(resourceDictionaryList); } + + @get('/resourcedictionary/model-type/{source}', { + responses: { + '200': { + content: { 'application/json': {} }, + }, + }, + }) + async getmodelType(@param.path.string('source') source: string) { + return await this.rdservice.getModelType(source); + } } diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts index c749eee62..af96aca04 100644 --- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts +++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts @@ -86,6 +86,23 @@ export default { "functions": { "searchbyNames": ["resourceDictionaryList"] + } + }, + , + { + "template": { + "method": "GET", + "url": controllerApiConfig.http.url + "/model-type/{source}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.http.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getModelType": ["source"] + } } ] diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts index 8bc61fad1..9a781d6b8 100644 --- a/cds-ui/server/src/services/resource-dictionary.service.ts +++ b/cds-ui/server/src/services/resource-dictionary.service.ts @@ -7,7 +7,8 @@ export interface ResourceDictionaryService { getSourceMapping(): Promise; getByTags(tags: string): Promise; save(resourceDictionary: JSON): Promise; - searchbyNames(resourceDictionaryList: JSON): Promise; + searchbyNames(resourceDictionaryList: JSON): Promise; + getModelType(source: string): Promise; } export class ResourceDictionaryServiceProvider implements Provider {