improve response, fix integration tests

This commit is contained in:
sbriat 2023-09-26 14:43:54 +02:00
parent d0285e265e
commit 3bc142f4f7
4 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import { StepResponseDto } from './step.response.dto'; import { StepResponseDto } from './step.response.dto';
export class JourneyResponseDto { export class JourneyResponseDto {
weekday: number; day: number;
firstDate: string; firstDate: string;
lastDate: string; lastDate: string;
steps: StepResponseDto[]; steps: StepResponseDto[];

View File

@ -69,7 +69,7 @@ message Match {
} }
message Journey { message Journey {
int32 weekday = 1; int32 day = 1;
string firstDate = 2; string firstDate = 2;
string lastDate = 3; string lastDate = 3;
repeated Step steps = 4; repeated Step steps = 4;

View File

@ -29,7 +29,7 @@ export class MatchMapper {
distanceDetourPercentage: match.getProps().distanceDetourPercentage, distanceDetourPercentage: match.getProps().distanceDetourPercentage,
durationDetourPercentage: match.getProps().durationDetourPercentage, durationDetourPercentage: match.getProps().durationDetourPercentage,
journeys: match.getProps().journeys.map((journey: Journey) => ({ journeys: match.getProps().journeys.map((journey: Journey) => ({
weekday: new Date( day: new Date(
this.outputDatetimeTransformer.fromDate( this.outputDatetimeTransformer.fromDate(
{ {
date: journey.firstDate.toISOString().split('T')[0], date: journey.firstDate.toISOString().split('T')[0],

View File

@ -89,12 +89,10 @@ describe('Ad Repository', () => {
strict: false, strict: false,
waypoints: [ waypoints: [
{ {
position: 0,
lon: 43.7102, lon: 43.7102,
lat: 7.262, lat: 7.262,
}, },
{ {
position: 1,
lon: 43.2965, lon: 43.2965,
lat: 5.3698, lat: 5.3698,
}, },
@ -126,7 +124,7 @@ describe('Ad Repository', () => {
}; };
const adToCreate: AdEntity = AdEntity.create(createAdProps); const adToCreate: AdEntity = AdEntity.create(createAdProps);
await adRepository.insertWithUnsupportedFields(adToCreate, 'ad'); await adRepository.insertExtra(adToCreate, 'ad');
const afterCount = await prismaService.ad.count(); const afterCount = await prismaService.ad.count();
@ -175,12 +173,10 @@ describe('Ad Repository', () => {
strict: false, strict: false,
waypoints: [ waypoints: [
{ {
position: 0,
lon: 43.7102, lon: 43.7102,
lat: 7.262, lat: 7.262,
}, },
{ {
position: 1,
lon: 43.2965, lon: 43.2965,
lat: 5.3698, lat: 5.3698,
}, },
@ -212,7 +208,7 @@ describe('Ad Repository', () => {
}; };
const adToCreate: AdEntity = AdEntity.create(createAdProps); const adToCreate: AdEntity = AdEntity.create(createAdProps);
await adRepository.insertWithUnsupportedFields(adToCreate, 'ad'); await adRepository.insertExtra(adToCreate, 'ad');
const afterCount = await prismaService.ad.count(); const afterCount = await prismaService.ad.count();