From fe649c81ebc19d972eea1d3cc5285c504f981e5b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Mar 2026 22:05:57 +0000 Subject: [PATCH] Change region to use top-left and bottom-right coordinates Replace center+delta region representation with a bounding box defined by topLeft and bottomRight coordinate pairs, which maps more directly to the visible map area. https://claude.ai/code/session_0162emnCi1KxW5FkTNn2ZrvH --- schema.graphqls | 6 ++---- src/entities/SharedEntities.ts | 6 ++---- src/index.ts | 6 ++---- .../__tests__/SystemResolverTests.test.ts | 18 ++++++++++-------- testHelpers/apolloTestServerHelpers.ts | 6 ++---- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/schema.graphqls b/schema.graphqls index d114e1a..54a2de4 100644 --- a/schema.graphqls +++ b/schema.graphqls @@ -18,10 +18,8 @@ type System { } type Region { - latitude: Float! - longitude: Float! - latitudeDelta: Float! - longitudeDelta: Float! + topLeft: Coordinates! + bottomRight: Coordinates! } type ParkingSystem { diff --git a/src/entities/SharedEntities.ts b/src/entities/SharedEntities.ts index e24f31a..af7b090 100644 --- a/src/entities/SharedEntities.ts +++ b/src/entities/SharedEntities.ts @@ -12,9 +12,7 @@ export interface ICoordinates { } export interface IRegion { - latitude: number; - longitude: number; - latitudeDelta: number; - longitudeDelta: number; + topLeft: ICoordinates; + bottomRight: ICoordinates; } diff --git a/src/index.ts b/src/index.ts index 24bfeb3..d709b1d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,10 +26,8 @@ const supportedSystems: InterchangeSystemBuilderArguments[] = [ useSelfUpdatingEtas: true, shuttleStopArrivalDegreeDelta: 0.001, initialRegion: { - latitude: 33.7937, - longitude: -117.8531, - latitudeDelta: 0.01, - longitudeDelta: 0.01, + topLeft: { latitude: 33.7987, longitude: -117.8581 }, + bottomRight: { latitude: 33.7887, longitude: -117.8481 }, }, } ] diff --git a/src/resolvers/__tests__/SystemResolverTests.test.ts b/src/resolvers/__tests__/SystemResolverTests.test.ts index a345469..502ed92 100644 --- a/src/resolvers/__tests__/SystemResolverTests.test.ts +++ b/src/resolvers/__tests__/SystemResolverTests.test.ts @@ -40,10 +40,14 @@ describe("SystemResolvers", () => { query GetSystemInitialRegion($systemId: ID!) { system(id: $systemId) { initialRegion { - latitude - longitude - latitudeDelta - longitudeDelta + topLeft { + latitude + longitude + } + bottomRight { + latitude + longitude + } } } } @@ -56,10 +60,8 @@ describe("SystemResolvers", () => { expect(response.body.singleResult.errors).toBeUndefined(); const initialRegion = (response.body.singleResult.data as any).system.initialRegion; expect(initialRegion).toEqual({ - latitude: 33.7937, - longitude: -117.8531, - latitudeDelta: 0.01, - longitudeDelta: 0.01, + topLeft: { latitude: 33.7987, longitude: -117.8581 }, + bottomRight: { latitude: 33.7887, longitude: -117.8481 }, }); }); }); diff --git a/testHelpers/apolloTestServerHelpers.ts b/testHelpers/apolloTestServerHelpers.ts index e8d721c..4d0e8ad 100644 --- a/testHelpers/apolloTestServerHelpers.ts +++ b/testHelpers/apolloTestServerHelpers.ts @@ -27,10 +27,8 @@ const systemInfoForTesting: InterchangeSystemBuilderArguments = { useSelfUpdatingEtas: false, shuttleStopArrivalDegreeDelta: 0.001, initialRegion: { - latitude: 33.7937, - longitude: -117.8531, - latitudeDelta: 0.01, - longitudeDelta: 0.01, + topLeft: { latitude: 33.7987, longitude: -117.8581 }, + bottomRight: { latitude: 33.7887, longitude: -117.8481 }, }, };