Remove most of the geography module and delegate it to external gRPC microservice

This commit is contained in:
Romain Thouvenin
2024-03-13 17:54:34 +01:00
parent d09bad60f7
commit 96c30cb1cc
59 changed files with 237 additions and 2037 deletions

View File

@@ -2,24 +2,12 @@ import { Module, Provider } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import {
DIRECTION_ENCODER,
GEODESIC,
GEOGRAPHY_CONFIGURATION_REPOSITORY,
GEOROUTER,
} from './geography.di-tokens';
import { PostgresDirectionEncoder } from './infrastructure/postgres-direction-encoder';
import { GetBasicRouteController } from './interface/controllers/get-basic-route.controller';
import { RouteMapper } from './route.mapper';
import { Geodesic } from './infrastructure/geodesic';
import { GraphhopperGeorouter } from './infrastructure/graphhopper-georouter';
import { HttpModule } from '@nestjs/axios';
import { GetRouteQueryHandler } from './core/application/queries/get-route/get-route.query-handler';
import { GetDetailedRouteController } from './interface/controllers/get-detailed-route.controller';
import { ConfigurationRepository } from '@mobicoop/configuration-module';
const queryHandlers: Provider[] = [GetRouteQueryHandler];
const mappers: Provider[] = [RouteMapper];
const adapters: Provider[] = [
{
provide: GEOGRAPHY_CONFIGURATION_REPOSITORY,
@@ -29,26 +17,11 @@ const adapters: Provider[] = [
provide: DIRECTION_ENCODER,
useClass: PostgresDirectionEncoder,
},
{
provide: GEOROUTER,
useClass: GraphhopperGeorouter,
},
{
provide: GEODESIC,
useClass: Geodesic,
},
GetBasicRouteController,
GetDetailedRouteController,
];
@Module({
imports: [CqrsModule, HttpModule],
providers: [...queryHandlers, ...mappers, ...adapters],
exports: [
RouteMapper,
DIRECTION_ENCODER,
GetBasicRouteController,
GetDetailedRouteController,
],
providers: [...adapters],
exports: [DIRECTION_ENCODER],
})
export class GeographyModule {}