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

export interface BlueprintService {
   getAllblueprints(): Promise<any>;
   getBlueprintsByKeyword(keyword: string): Promise<any>;
   getByTags(tags: string): Promise<JSON>;
   getPagedBueprints(limit: number, offset: number , sort: string): Promise<any>;
   getMetaDataPagedBlueprints(limit: number, offset: number, sort: string, keyword: string): Promise<any>;


}

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

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