Rename GeorouterProvider[Port] to Georouter[Port]

This commit is contained in:
Romain Thouvenin 2024-03-19 08:03:50 +01:00
parent 357746e843
commit 579415c300
11 changed files with 22 additions and 22 deletions

View File

@ -40,7 +40,7 @@ import {
} from '@songkeys/nestjs-redis';
import { ConfigurationRepository } from '@mobicoop/configuration-module';
import { PublishMessageWhenMatcherAdIsCreatedDomainEventHandler } from './core/application/event-handlers/publish-message-when-matcher-ad-is-created.domain-event-handler';
import { GeorouterProvider } from './infrastructure/georouter-provider';
import { Georouter } from './infrastructure/georouter';
import { ClientsModule, Transport } from '@nestjs/microservices';
import { GRPC_GEOGRAPHY_PACKAGE_NAME } from '@src/app.constants';
import { join } from 'path';
@ -139,7 +139,7 @@ const adapters: Provider[] = [
},
{
provide: AD_ROUTE_PROVIDER,
useClass: GeorouterProvider,
useClass: Georouter,
},
{
provide: TIMEZONE_FINDER,

View File

@ -26,7 +26,7 @@ import { Point as PointValueObject } from '@modules/ad/core/domain/value-objects
import { Point } from '@modules/geography/core/domain/route.types';
import { MatcherAdCreationFailedIntegrationEvent } from '../../events/matcher-ad-creation-failed.integration-event';
import { MATCHER_AD_CREATION_FAILED_ROUTING_KEY } from '@src/app.constants';
import { GeorouterProviderPort } from '../../ports/georouter-provider.port';
import { GeorouterPort } from '../../ports/georouter.port';
@CommandHandler(CreateAdCommand)
export class CreateAdService implements ICommandHandler {
@ -36,7 +36,7 @@ export class CreateAdService implements ICommandHandler {
@Inject(AD_REPOSITORY)
private readonly repository: AdRepositoryPort,
@Inject(AD_ROUTE_PROVIDER)
private readonly routeProvider: GeorouterProviderPort,
private readonly routeProvider: GeorouterPort,
) {}
async execute(command: CreateAdCommand): Promise<AggregateID> {

View File

@ -26,6 +26,6 @@ export type RouteResponse = {
};
@Injectable()
export abstract class GeorouterProviderPort {
export abstract class GeorouterPort {
abstract getRoute(request: RouteRequest): Promise<RouteResponse>;
}

View File

@ -3,7 +3,7 @@ import { Completer } from './completer.abstract';
import { MatchQuery } from '../match.query';
import { Step } from '../../../types/step.type';
import { CarpoolPathItem } from '@modules/ad/core/domain/value-objects/carpool-path-item.value-object';
import { RouteResponse } from '../../../ports/georouter-provider.port';
import { RouteResponse } from '../../../ports/georouter.port';
export class RouteCompleter extends Completer {
protected readonly type: RouteCompleterType;

View File

@ -12,7 +12,7 @@ import {
} from '@modules/ad/core/domain/path-creator.service';
import { Point } from '@modules/ad/core/domain/value-objects/point.value-object';
import { Route } from '../../types/route.type';
import { GeorouterProviderPort } from '../../ports/georouter-provider.port';
import { GeorouterPort } from '../../ports/georouter.port';
export class MatchQuery extends QueryBase {
id?: string;
@ -40,10 +40,10 @@ export class MatchQuery extends QueryBase {
passengerRoute?: Route;
backAzimuth?: number;
private readonly originWaypoint: Waypoint;
routeProvider: GeorouterProviderPort;
routeProvider: GeorouterPort;
// TODO: remove MatchRequestDto depency (here core domain depends on interface /!\)
constructor(props: MatchRequestDto, routeProvider: GeorouterProviderPort) {
constructor(props: MatchRequestDto, routeProvider: GeorouterPort) {
super();
this.id = props.id;
this.driver = props.driver;

View File

@ -3,10 +3,10 @@ import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import { GRPC_GEOROUTER_SERVICE_NAME } from '@src/app.constants';
import {
GeorouterProviderPort,
GeorouterPort,
RouteRequest,
RouteResponse,
} from '../core/application/ports/georouter-provider.port';
} from '../core/application/ports/georouter.port';
import { GEOGRAPHY_PACKAGE } from '../ad.di-tokens';
interface GeorouterService {
@ -14,7 +14,7 @@ interface GeorouterService {
}
@Injectable()
export class GeorouterProvider implements GeorouterProviderPort, OnModuleInit {
export class Georouter implements GeorouterPort, OnModuleInit {
private georouterService: GeorouterService;
constructor(@Inject(GEOGRAPHY_PACKAGE) private readonly client: ClientGrpc) {}

View File

@ -11,7 +11,7 @@ import { AD_ROUTE_PROVIDER } from '@modules/ad/ad.di-tokens';
import { MatchMapper } from '@modules/ad/match.mapper';
import { MatchingResult } from '@modules/ad/core/application/queries/match/match.query-handler';
import { CacheInterceptor, CacheKey } from '@nestjs/cache-manager';
import { GeorouterProviderPort } from '@modules/ad/core/application/ports/georouter-provider.port';
import { GeorouterPort } from '@modules/ad/core/application/ports/georouter.port';
@UsePipes(
new RpcValidationPipe({
@ -24,7 +24,7 @@ export class MatchGrpcController {
constructor(
private readonly queryBus: QueryBus,
@Inject(AD_ROUTE_PROVIDER)
private readonly routeProvider: GeorouterProviderPort,
private readonly routeProvider: GeorouterPort,
private readonly matchMapper: MatchMapper,
) {}

View File

@ -12,7 +12,7 @@ import { CreateAdService } from '@modules/ad/core/application/commands/create-ad
import { CreateAdCommand } from '@modules/ad/core/application/commands/create-ad/create-ad.command';
import { AdAlreadyExistsException } from '@modules/ad/core/domain/ad.errors';
import { PointProps } from '@modules/ad/core/domain/value-objects/point.value-object';
import { GeorouterProviderPort } from '@modules/ad/core/application/ports/georouter-provider.port';
import { GeorouterPort } from '@modules/ad/core/application/ports/georouter.port';
const originWaypoint: PointProps = {
lat: 48.689445,
@ -62,7 +62,7 @@ const mockAdRepository = {
}),
};
const mockRouteProvider: GeorouterProviderPort = {
const mockRouteProvider: GeorouterPort = {
getRoute: jest
.fn()
.mockImplementationOnce(() => {

View File

@ -1,5 +1,5 @@
import { DateTimeTransformerPort } from '@modules/ad/core/application/ports/datetime-transformer.port';
import { GeorouterProviderPort } from '@modules/ad/core/application/ports/georouter-provider.port';
import { GeorouterPort } from '@modules/ad/core/application/ports/georouter.port';
import { MatchQuery } from '@modules/ad/core/application/queries/match/match.query';
import { AlgorithmType } from '@modules/ad/core/application/types/algorithm.types';
import { Waypoint } from '@modules/ad/core/application/types/waypoint.type';
@ -58,7 +58,7 @@ const mockInputDateTimeTransformer: DateTimeTransformerPort = {
time: jest.fn().mockImplementation(() => '23:05'),
};
const mockRouteProvider: GeorouterProviderPort = {
const mockRouteProvider: GeorouterPort = {
getRoute: jest
.fn()
.mockImplementationOnce(simpleMockGeorouter.getRoute)

View File

@ -1,7 +1,7 @@
import {
RouteRequest,
RouteResponse,
} from '@modules/ad/core/application/ports/georouter-provider.port';
} from '@modules/ad/core/application/ports/georouter.port';
import {
RouteCompleter,
RouteCompleterType,

View File

@ -1,10 +1,10 @@
import { GeorouterProviderPort } from '@modules/ad/core/application/ports/georouter-provider.port';
import { GeorouterPort } from '@modules/ad/core/application/ports/georouter.port';
export const bareMockGeorouter: GeorouterProviderPort = {
export const bareMockGeorouter: GeorouterPort = {
getRoute: jest.fn(),
};
export const simpleMockGeorouter: GeorouterProviderPort = {
export const simpleMockGeorouter: GeorouterPort = {
getRoute: jest.fn().mockImplementation(() => ({
distance: 350101,
duration: 14422,