summaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src/services/resource-dictionary.service.ts
blob: 44ba1a3477b20b71056d7d1f255eeac9c1deebe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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<JSON>;
  getSourceMapping(authtoken: string): Promise<JSON>;
  getByTags(tags: string, authtoken: string): Promise<JSON>;
  save(authtoken: string, resourceDictionary: JSON): Promise<JSON>;
  searchbyNames(authtoken: string, resourceDictionaryList: JSON): Promise<JSON>;
}

export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
  constructor(
    // resourceDictionary must match the name property in the datasource json file
    @inject('datasources.resourceDictionary')
    protected dataSource: ResourceDictionaryDataSource = new ResourceDictionaryDataSource(),
  ) {}

  value(): Promise<ResourceDictionaryService> {
    return getService(this.dataSource);
  }
}