import {getService} from '@loopback/service-proxy'; import {inject, Provider} from '@loopback/core'; import {CmsDataSource} from '../datasources'; export interface Cms { // sonarignore:start getAll( model: string, token: string, filter?: any, populate?: any, ): Promise<{data: any[]}>; getById( model: string, id: string, token: string, filter?: string, ): Promise; getCount(model: string, token: string, filter?: string): Promise; getUrl(token: string, tenantId?: string): Promise; // sonarignore:end } export class CmsProvider implements Provider { constructor( // cms must match the name property in the datasource json file @inject('datasources.cms') protected dataSource: CmsDataSource = new CmsDataSource(), ) {} value(): Promise { return getService(this.dataSource); } }