aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src/services/controller-catalog.service.ts
blob: 9b48805437823da9304c36a5e30c427cbe4554de (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>;
  deleteCatalog(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);
  }
}