loopback Api- get Sources list 18/91618/1
authorArundathi Patil <arundpil@in.ibm.com>
Wed, 17 Jul 2019 17:02:44 +0000 (22:32 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Wed, 17 Jul 2019 17:02:55 +0000 (22:32 +0530)
Implemented api to fetch source list from backend

Issue-ID: CCSDK-707
Change-Id: Ica7a3177f7a426456d921474a7758d2745eae33f
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
cds-ui/server/src/controllers/data-dictionary.controller.ts
cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
cds-ui/server/src/services/resource-dictionary.service.ts

index 486c286..63587e6 100644 (file)
@@ -84,4 +84,15 @@ export class DataDictionaryController {
   }) resourceDictionaryList: JSON): Promise<any> {
     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);
+  }
 }
index c749eee..af96aca 100644 (file)
@@ -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"]
+
             }
         }
     ]
index 8bc61fa..9a781d6 100644 (file)
@@ -7,7 +7,8 @@ export interface ResourceDictionaryService {
   getSourceMapping(): Promise<JSON>;
   getByTags(tags: string): Promise<JSON>;
   save(resourceDictionary: JSON): Promise<JSON>;
-  searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
+  searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;  
+  getModelType(source: string): Promise<JSON>;
 }
 
 export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {