fix module

This commit is contained in:
sbriat 2023-08-23 14:37:25 +02:00
parent 66d4d58dd1
commit 39cebda0b9
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,5 @@
import { Path, Route } from '../../domain/route.types';
import { GeorouterSettings } from '../types/georouter-settings.type'; import { GeorouterSettings } from '../types/georouter-settings.type';
import { Path } from '../types/path.type';
import { Route } from '../types/route.type';
export interface GeorouterPort { export interface GeorouterPort {
routes(paths: Path[], settings: GeorouterSettings): Promise<Route[]>; routes(paths: Path[], settings: GeorouterSettings): Promise<Route[]>;

View File

@ -3,6 +3,7 @@ import { CqrsModule } from '@nestjs/cqrs';
import { import {
DIRECTION_ENCODER, DIRECTION_ENCODER,
GEODESIC, GEODESIC,
GEOROUTER,
PARAMS_PROVIDER, PARAMS_PROVIDER,
} from './geography.di-tokens'; } from './geography.di-tokens';
import { DefaultParamsProvider } from './infrastructure/default-params-provider'; import { DefaultParamsProvider } from './infrastructure/default-params-provider';
@ -10,6 +11,8 @@ import { PostgresDirectionEncoder } from './infrastructure/postgres-direction-en
import { GetBasicRouteController } from './interface/controllers/get-basic-route.controller'; import { GetBasicRouteController } from './interface/controllers/get-basic-route.controller';
import { RouteMapper } from './route.mapper'; import { RouteMapper } from './route.mapper';
import { Geodesic } from './infrastructure/geodesic'; import { Geodesic } from './infrastructure/geodesic';
import { GraphhopperGeorouter } from './infrastructure/graphhopper-georouter';
import { HttpModule } from '@nestjs/axios';
const mappers: Provider[] = [RouteMapper]; const mappers: Provider[] = [RouteMapper];
@ -22,6 +25,10 @@ const adapters: Provider[] = [
provide: DIRECTION_ENCODER, provide: DIRECTION_ENCODER,
useClass: PostgresDirectionEncoder, useClass: PostgresDirectionEncoder,
}, },
{
provide: GEOROUTER,
useClass: GraphhopperGeorouter,
},
{ {
provide: GEODESIC, provide: GEODESIC,
useClass: Geodesic, useClass: Geodesic,
@ -30,7 +37,7 @@ const adapters: Provider[] = [
]; ];
@Module({ @Module({
imports: [CqrsModule], imports: [CqrsModule, HttpModule],
providers: [...mappers, ...adapters], providers: [...mappers, ...adapters],
exports: [RouteMapper, DIRECTION_ENCODER, GetBasicRouteController], exports: [RouteMapper, DIRECTION_ENCODER, GetBasicRouteController],
}) })