From ebbafcac64d3dadf3abc380f091ccc368386af34 Mon Sep 17 00:00:00 2001 From: Ezhilarasi Date: Thu, 11 Apr 2019 21:09:26 +0530 Subject: Resource Dictionary Loopback integration Change-Id: If1b3dbc23797e03f97deab7d67f9adb22d07bc1c Issue-ID: CCSDK-1070 Signed-off-by: Ezhilarasi --- .../src/services/resource-dictionary.service.ts | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cds-ui/server/src/services/resource-dictionary.service.ts (limited to 'cds-ui/server/src/services/resource-dictionary.service.ts') diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts new file mode 100644 index 000000000..44ba1a347 --- /dev/null +++ b/cds-ui/server/src/services/resource-dictionary.service.ts @@ -0,0 +1,23 @@ +import {getService} from '@loopback/service-proxy'; +import {inject, Provider} from '@loopback/core'; +import {ResourceDictionaryDataSource} from '../datasources'; + +export interface ResourceDictionaryService { + getByName(name: string, authtoken: string): Promise; + getSourceMapping(authtoken: string): Promise; + getByTags(tags: string, authtoken: string): Promise; + save(authtoken: string, resourceDictionary: JSON): Promise; + searchbyNames(authtoken: string, resourceDictionaryList: JSON): Promise; +} + +export class ResourceDictionaryServiceProvider implements Provider { + constructor( + // resourceDictionary must match the name property in the datasource json file + @inject('datasources.resourceDictionary') + protected dataSource: ResourceDictionaryDataSource = new ResourceDictionaryDataSource(), + ) {} + + value(): Promise { + return getService(this.dataSource); + } +} -- cgit 1.2.3-korg