blob: 44ba1a3477b20b71056d7d1f255eeac9c1deebe9 [file] [log] [blame]
Ezhilarasiebbafca2019-04-11 21:09:26 +05301import {getService} from '@loopback/service-proxy';
2import {inject, Provider} from '@loopback/core';
3import {ResourceDictionaryDataSource} from '../datasources';
4
5export interface ResourceDictionaryService {
6 getByName(name: string, authtoken: string): Promise<JSON>;
7 getSourceMapping(authtoken: string): Promise<JSON>;
8 getByTags(tags: string, authtoken: string): Promise<JSON>;
9 save(authtoken: string, resourceDictionary: JSON): Promise<JSON>;
10 searchbyNames(authtoken: string, resourceDictionaryList: JSON): Promise<JSON>;
11}
12
13export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
14 constructor(
15 // resourceDictionary must match the name property in the datasource json file
16 @inject('datasources.resourceDictionary')
17 protected dataSource: ResourceDictionaryDataSource = new ResourceDictionaryDataSource(),
18 ) {}
19
20 value(): Promise<ResourceDictionaryService> {
21 return getService(this.dataSource);
22 }
23}