Skip to content

Commit 672825d

Browse files
committed
RU-T49 Adding routes and more langs
1 parent ff80618 commit 672825d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+11480
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Gemfile
3737

3838
expo-env.d.ts
3939
# @end expo-cli
40+
.dual-graph/

src/api/mapping/mapping.ts

Lines changed: 170 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,57 @@
1+
import { type FeatureCollection } from 'geojson';
2+
13
import { type GetMapDataAndMarkersResult } from '@/models/v4/mapping/getMapDataAndMarkersResult';
24
import { type GetMapLayersResult } from '@/models/v4/mapping/getMapLayersResult';
5+
import {
6+
type GetAllActiveLayersResult,
7+
type GetCustomMapResult,
8+
type GetCustomMapsResult,
9+
type GetGeoJSONResult,
10+
type GetIndoorMapFloorResult,
11+
type GetIndoorMapResult,
12+
type GetIndoorMapsResult,
13+
type SearchAllMapFeaturesResult,
14+
type SearchCustomMapRegionsResult,
15+
type SearchIndoorLocationsResult,
16+
} from '@/models/v4/mapping/mappingResults';
317

18+
import { createCachedApiEndpoint } from '../common/cached-client';
419
import { createApiEndpoint } from '../common/client';
520

621
const getMayLayersApi = createApiEndpoint('/Mapping/GetMayLayers');
7-
822
const getMapDataAndMarkersApi = createApiEndpoint('/Mapping/GetMapDataAndMarkers');
923

24+
// Indoor map endpoints
25+
const getIndoorMapsApi = createCachedApiEndpoint('/Mapping/GetIndoorMaps', {
26+
ttl: 5 * 60 * 1000,
27+
enabled: true,
28+
});
29+
const getIndoorMapApi = createApiEndpoint('/Mapping/GetIndoorMap');
30+
const getIndoorMapFloorApi = createApiEndpoint('/Mapping/GetIndoorMapFloor');
31+
const getIndoorMapZonesGeoJSONApi = createApiEndpoint('/Mapping/GetIndoorMapZonesGeoJSON');
32+
const searchIndoorLocationsApi = createApiEndpoint('/Mapping/SearchIndoorLocations');
33+
const getNearbyIndoorMapsApi = createApiEndpoint('/Mapping/GetNearbyIndoorMaps');
34+
35+
// Custom map endpoints
36+
const getCustomMapsApi = createCachedApiEndpoint('/Mapping/GetCustomMaps', {
37+
ttl: 5 * 60 * 1000,
38+
enabled: true,
39+
});
40+
const getCustomMapApi = createApiEndpoint('/Mapping/GetCustomMap');
41+
const getCustomMapLayerApi = createApiEndpoint('/Mapping/GetCustomMapLayer');
42+
const getMapLayerGeoJSONApi = createApiEndpoint('/Mapping/GetMapLayerGeoJSON');
43+
const getCustomMapRegionsGeoJSONApi = createApiEndpoint('/Mapping/GetCustomMapRegionsGeoJSON');
44+
const searchCustomMapRegionsApi = createApiEndpoint('/Mapping/SearchCustomMapRegions');
45+
46+
// Discovery endpoints
47+
const getAllActiveLayersApi = createCachedApiEndpoint('/Mapping/GetAllActiveLayers', {
48+
ttl: 5 * 60 * 1000,
49+
enabled: true,
50+
});
51+
const searchAllMapFeaturesApi = createApiEndpoint('/Mapping/SearchAllMapFeatures');
52+
53+
// --- Existing Endpoints ---
54+
1055
export const getMapDataAndMarkers = async (signal?: AbortSignal) => {
1156
const response = await getMapDataAndMarkersApi.get<GetMapDataAndMarkersResult>(undefined, signal);
1257
return response.data;
@@ -21,3 +66,127 @@ export const getMayLayers = async (type: number, signal?: AbortSignal) => {
2166
);
2267
return response.data;
2368
};
69+
70+
// --- Indoor Maps ---
71+
72+
export const getIndoorMaps = async () => {
73+
const response = await getIndoorMapsApi.get<GetIndoorMapsResult>();
74+
return response.data;
75+
};
76+
77+
export const getIndoorMap = async (mapId: string) => {
78+
const response = await getIndoorMapApi.get<GetIndoorMapResult>({
79+
id: encodeURIComponent(mapId),
80+
});
81+
return response.data;
82+
};
83+
84+
export const getIndoorMapFloor = async (floorId: string) => {
85+
const response = await getIndoorMapFloorApi.get<GetIndoorMapFloorResult>({
86+
floorId: encodeURIComponent(floorId),
87+
});
88+
return response.data;
89+
};
90+
91+
export const getIndoorMapZonesGeoJSON = async (floorId: string) => {
92+
const response = await getIndoorMapZonesGeoJSONApi.get<GetGeoJSONResult>({
93+
floorId: encodeURIComponent(floorId),
94+
});
95+
return response.data;
96+
};
97+
98+
export const searchIndoorLocations = async (term: string, mapId?: string) => {
99+
const params: Record<string, unknown> = { term: encodeURIComponent(term) };
100+
if (mapId) {
101+
params.mapId = encodeURIComponent(mapId);
102+
}
103+
const response = await searchIndoorLocationsApi.get<SearchIndoorLocationsResult>(params);
104+
return response.data;
105+
};
106+
107+
export const getNearbyIndoorMaps = async (lat: number, lon: number, radiusMeters: number) => {
108+
const response = await getNearbyIndoorMapsApi.get<GetIndoorMapsResult>({
109+
lat,
110+
lon,
111+
radiusMeters,
112+
});
113+
return response.data;
114+
};
115+
116+
// --- Custom Maps ---
117+
118+
export const getCustomMaps = async (type?: number) => {
119+
const params: Record<string, unknown> = {};
120+
if (type !== undefined) {
121+
params.type = encodeURIComponent(type);
122+
}
123+
const response = await getCustomMapsApi.get<GetCustomMapsResult>(params);
124+
return response.data;
125+
};
126+
127+
export const getCustomMap = async (mapId: string) => {
128+
const response = await getCustomMapApi.get<GetCustomMapResult>({
129+
id: encodeURIComponent(mapId),
130+
});
131+
return response.data;
132+
};
133+
134+
export const getCustomMapLayer = async (layerId: string) => {
135+
const response = await getCustomMapLayerApi.get<GetGeoJSONResult>({
136+
layerId: encodeURIComponent(layerId),
137+
});
138+
return response.data;
139+
};
140+
141+
export const getMapLayerGeoJSON = async (layerId: string) => {
142+
const response = await getMapLayerGeoJSONApi.get<GetGeoJSONResult>({
143+
layerId: encodeURIComponent(layerId),
144+
});
145+
return response.data;
146+
};
147+
148+
export const getCustomMapRegionsGeoJSON = async (layerId: string) => {
149+
const response = await getCustomMapRegionsGeoJSONApi.get<GetGeoJSONResult>({
150+
layerId: encodeURIComponent(layerId),
151+
});
152+
return response.data;
153+
};
154+
155+
export const searchCustomMapRegions = async (term: string, layerId?: string) => {
156+
const params: Record<string, unknown> = { term: encodeURIComponent(term) };
157+
if (layerId) {
158+
params.layerId = encodeURIComponent(layerId);
159+
}
160+
const response = await searchCustomMapRegionsApi.get<SearchCustomMapRegionsResult>(params);
161+
return response.data;
162+
};
163+
164+
// --- Discovery & Search ---
165+
166+
export const getAllActiveLayers = async () => {
167+
const response = await getAllActiveLayersApi.get<GetAllActiveLayersResult>();
168+
return response.data;
169+
};
170+
171+
export const searchAllMapFeatures = async (term: string, type?: 'all' | 'indoor' | 'custom') => {
172+
const params: Record<string, unknown> = { term: encodeURIComponent(term) };
173+
if (type) {
174+
params.type = type;
175+
}
176+
const response = await searchAllMapFeaturesApi.get<SearchAllMapFeaturesResult>(params);
177+
return response.data;
178+
};
179+
180+
// --- URL Helpers (no fetch needed, constructs URLs for components) ---
181+
182+
export const getFloorImageUrl = (floorId: string): string => {
183+
return `/api/v4/Mapping/GetIndoorMapFloorImage/${encodeURIComponent(floorId)}`;
184+
};
185+
186+
export const getCustomMapLayerImageUrl = (layerId: string): string => {
187+
return `/api/v4/Mapping/GetCustomMapLayerImage/${encodeURIComponent(layerId)}`;
188+
};
189+
190+
export const getCustomMapTileUrl = (layerId: string): string => {
191+
return `/api/v4/Mapping/GetCustomMapTile/${encodeURIComponent(layerId)}/{z}/{x}/{y}`;
192+
};

0 commit comments

Comments
 (0)