aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src/services/controller-catalog.service.ts
blob: db8d8560c34c22e55064c1422d78ceb84d155cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {getService} from '@loopback/service-proxy';
import {inject, Provider} from '@loopback/core';
import {ControllerCatalogDataSource} from '../datasources';

export interface ControllerCatalogService {
  getByTags(tags: string): Promise<JSON>;
  save(controllerCatalog: JSON): Promise<JSON>;
  getDefinitionTypes(definitionType: string): Promise<JSON>;
  delete(name: string): Promise<JSON>;
}

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

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