From 3bc142f4f730eb65975351555abea7fe0d0024ae Mon Sep 17 00:00:00 2001 From: sbriat Date: Tue, 26 Sep 2023 14:43:54 +0200 Subject: [PATCH] improve response, fix integration tests --- src/modules/ad/interface/dtos/journey.response.dto.ts | 2 +- src/modules/ad/interface/grpc-controllers/matcher.proto | 2 +- src/modules/ad/match.mapper.ts | 2 +- src/modules/ad/tests/integration/ad.repository.spec.ts | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/modules/ad/interface/dtos/journey.response.dto.ts b/src/modules/ad/interface/dtos/journey.response.dto.ts index 2f0aa5c..f01599b 100644 --- a/src/modules/ad/interface/dtos/journey.response.dto.ts +++ b/src/modules/ad/interface/dtos/journey.response.dto.ts @@ -1,7 +1,7 @@ import { StepResponseDto } from './step.response.dto'; export class JourneyResponseDto { - weekday: number; + day: number; firstDate: string; lastDate: string; steps: StepResponseDto[]; diff --git a/src/modules/ad/interface/grpc-controllers/matcher.proto b/src/modules/ad/interface/grpc-controllers/matcher.proto index 0bc68f6..44dae76 100644 --- a/src/modules/ad/interface/grpc-controllers/matcher.proto +++ b/src/modules/ad/interface/grpc-controllers/matcher.proto @@ -69,7 +69,7 @@ message Match { } message Journey { - int32 weekday = 1; + int32 day = 1; string firstDate = 2; string lastDate = 3; repeated Step steps = 4; diff --git a/src/modules/ad/match.mapper.ts b/src/modules/ad/match.mapper.ts index 91be4ce..e8b60c4 100644 --- a/src/modules/ad/match.mapper.ts +++ b/src/modules/ad/match.mapper.ts @@ -29,7 +29,7 @@ export class MatchMapper { distanceDetourPercentage: match.getProps().distanceDetourPercentage, durationDetourPercentage: match.getProps().durationDetourPercentage, journeys: match.getProps().journeys.map((journey: Journey) => ({ - weekday: new Date( + day: new Date( this.outputDatetimeTransformer.fromDate( { date: journey.firstDate.toISOString().split('T')[0], diff --git a/src/modules/ad/tests/integration/ad.repository.spec.ts b/src/modules/ad/tests/integration/ad.repository.spec.ts index c74557c..2b29066 100644 --- a/src/modules/ad/tests/integration/ad.repository.spec.ts +++ b/src/modules/ad/tests/integration/ad.repository.spec.ts @@ -89,12 +89,10 @@ describe('Ad Repository', () => { strict: false, waypoints: [ { - position: 0, lon: 43.7102, lat: 7.262, }, { - position: 1, lon: 43.2965, lat: 5.3698, }, @@ -126,7 +124,7 @@ describe('Ad Repository', () => { }; const adToCreate: AdEntity = AdEntity.create(createAdProps); - await adRepository.insertWithUnsupportedFields(adToCreate, 'ad'); + await adRepository.insertExtra(adToCreate, 'ad'); const afterCount = await prismaService.ad.count(); @@ -175,12 +173,10 @@ describe('Ad Repository', () => { strict: false, waypoints: [ { - position: 0, lon: 43.7102, lat: 7.262, }, { - position: 1, lon: 43.2965, lat: 5.3698, }, @@ -212,7 +208,7 @@ describe('Ad Repository', () => { }; const adToCreate: AdEntity = AdEntity.create(createAdProps); - await adRepository.insertWithUnsupportedFields(adToCreate, 'ad'); + await adRepository.insertExtra(adToCreate, 'ad'); const afterCount = await prismaService.ad.count();