add service for getting model type with definition 52/99152/3
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>
Wed, 4 Dec 2019 15:09:41 +0000 (17:09 +0200)
committerKAPIL SINGAL <ks220y@att.com>
Fri, 6 Dec 2019 19:40:21 +0000 (19:40 +0000)
Issue-ID: CCSDK-1770

Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I7f3278e97119a144c889d83891fa5de6796c7fb2

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 eab0bc5..076d714 100644 (file)
@@ -96,6 +96,9 @@ export class DataDictionaryController {
     return await this.rdservice.getModelType(source);
   }
 
+  /**
+   * @deprecated   use getResourceDictionaryByType Instead.
+   */
   @get('/resourcedictionary/model-type/by-definition/data_type', {
     responses: {
       '200': {
@@ -104,6 +107,19 @@ export class DataDictionaryController {
     },
   })
   async getDataTypes() {
+    console.warn("Calling deprecated function!");
     return await this.rdservice.getDataTypes();
   }
+
+  @get('/resourcedictionary/model-type/by-definition/{type}', {
+    responses: {
+      '200': {
+        content: {'application/json': {}},
+      },
+    },
+  })
+  async getResourceDictionaryByType(@param.path.string('type') type: string) {
+    return await this.rdservice.getResourceDictionaryByType(type);
+  }
+
 }
index f839bb2..7373d06 100644 (file)
@@ -118,7 +118,23 @@ export default {
             "functions": {
                 "getDataTypes": []
 
+            }
+        },
+        {
+            "template": {
+                "method": "GET",
+                "url": processorApiConfig.http.url + "/model-type/by-definition/{type}",
+                "headers": {
+                    "accepts": "application/json",
+                    "content-type": "application/json",
+                    "authorization": processorApiConfig.http.authToken
+                },
+                "responsePath": "$.*"
+            },
+            "functions": {
+                "getResourceDictionaryByType": ["type"]
+
             }
         }
     ]
-};
\ No newline at end of file
+};
index 8df2208..a36c7fe 100644 (file)
@@ -7,9 +7,10 @@ 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>;
   getDataTypes(): Promise<JSON>;
+  getResourceDictionaryByType(type: string): Promise<JSON>;
 }
 
 export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {