Skip to content

Commit 47510ba

Browse files
author
Moussa Iskounene
committed
feat(createStopCluster): Add new field unique_name to null for StopCluster
1 parent 2c05e37 commit 47510ba

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

__tests__/groundplaces/createStopCluster.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('#createStopCluster', () => {
6767
longitude: 7.6275127,
6868
latitude: 48.5857122,
6969
type: 'cluster',
70+
unique_name: null,
7071
},
7172
]);
7273
expect(groundPlacesService.getGroundPlacesActionHistory()).toStrictEqual([

src/classes/groundplaces.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class GroundPlacesController {
104104
if (
105105
!place.gpuid.toLowerCase().includes(currentQuery) &&
106106
!place.name.toLowerCase().includes(currentQuery) &&
107-
!(place.type === GroundPlaceType.CLUSTER && place.unique_name.toLowerCase().includes(currentQuery)) &&
107+
!(place.type === GroundPlaceType.CLUSTER && place.unique_name?.toLowerCase().includes(currentQuery)) &&
108108
!(
109109
place.type === GroundPlaceType.GROUP &&
110110
place.childs.some((segmentProviderStop: SegmentProviderStop) =>

src/helpers/parse.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GroundPlaceServiced, GenerateGpuidGroundPlace, GroundPlace } from '../types';
1+
import { GroundPlaceServiced, GenerateGpuidGroundPlace, GroundPlace, GroundPlaceType } from '../types';
22
import { removeUndefinedValues } from './sanitize';
33

44
/**
@@ -17,6 +17,8 @@ const parseGeneratePlaceToGroundPlace = (generateGpuidGroundPlace: GenerateGpuid
1717
type: generateGpuidGroundPlace.type,
1818
childs: [],
1919
serviced: GroundPlaceServiced.FALSE,
20+
// Create `unique_name` attribute set to `null` only for StopCluster
21+
...(generateGpuidGroundPlace.type === GroundPlaceType.CLUSTER ? { unique_name: null } : {}),
2022
};
2123

2224
removeUndefinedValues(newGroundPlace);

src/types/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ interface GenerateGpuidGroundPlace {
5252
latitude: number;
5353
type: GroundPlaceType;
5454
address?: string;
55+
unique_name?: string | null;
5556
}
5657

5758
interface SegmentProviderStop {

0 commit comments

Comments
 (0)