29 lines
1020 B
TypeScript
29 lines
1020 B
TypeScript
import { Inject, Injectable } from '@nestjs/common';
|
|
import { RouteProviderPort } from '../core/application/ports/route-provider.port';
|
|
import { GetRouteControllerPort } from '@modules/geography/core/application/ports/get-route-controller.port';
|
|
import {
|
|
AD_GET_BASIC_ROUTE_CONTROLLER,
|
|
AD_GET_DETAILED_ROUTE_CONTROLLER,
|
|
} from '../ad.di-tokens';
|
|
import { Point, Route } from '@modules/geography/core/domain/route.types';
|
|
|
|
@Injectable()
|
|
export class RouteProvider implements RouteProviderPort {
|
|
constructor(
|
|
@Inject(AD_GET_BASIC_ROUTE_CONTROLLER)
|
|
private readonly getBasicRouteController: GetRouteControllerPort,
|
|
@Inject(AD_GET_DETAILED_ROUTE_CONTROLLER)
|
|
private readonly getDetailedRouteController: GetRouteControllerPort,
|
|
) {}
|
|
|
|
getBasic = async (waypoints: Point[]): Promise<Route> =>
|
|
await this.getBasicRouteController.get({
|
|
waypoints,
|
|
});
|
|
|
|
getDetailed = async (waypoints: Point[]): Promise<Route> =>
|
|
await this.getDetailedRouteController.get({
|
|
waypoints,
|
|
});
|
|
}
|