fix: restore map geometries and SMTP configuration
DH V2 CI / API · typecheck, tests, build (push) Successful in 38s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / WEB · typecheck, build (push) Successful in 1m36s
DH V2 CI / Docker / migrations / production images (push) Successful in 1m45s
DH V2 CI / Promote verified main to deploy (push) Successful in 3s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 4m5s
DH V2 CI / API · typecheck, tests, build (push) Successful in 38s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / WEB · typecheck, build (push) Successful in 1m36s
DH V2 CI / Docker / migrations / production images (push) Successful in 1m45s
DH V2 CI / Promote verified main to deploy (push) Successful in 3s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 4m5s
This commit is contained in:
+13
-4
@@ -536,9 +536,9 @@ export type Position = [number, number];
|
||||
export type AssetGeometryType = 'POINT' | 'LINESTRING' | 'POLYGON';
|
||||
|
||||
export type GeoJsonGeometry =
|
||||
| { type: 'POINT'; coordinates: Position }
|
||||
| { type: 'LINESTRING'; coordinates: Position[] }
|
||||
| { type: 'POLYGON'; coordinates: Position[][] };
|
||||
| { type: 'Point'; coordinates: Position }
|
||||
| { type: 'LineString'; coordinates: Position[] }
|
||||
| { type: 'Polygon'; coordinates: Position[][] };
|
||||
|
||||
export interface AssetGeometry {
|
||||
assetId: string;
|
||||
@@ -2162,6 +2162,15 @@ export async function getAssetGeometry(assetId: string) {
|
||||
return (await apiRequest<{ data: AssetGeometry | null }>(`/assets/${assetId}/geometry`)).data;
|
||||
}
|
||||
|
||||
function geometryPayload(geometry: GeoJsonGeometry) {
|
||||
const type: AssetGeometryType = geometry.type === 'Point'
|
||||
? 'POINT'
|
||||
: geometry.type === 'LineString'
|
||||
? 'LINESTRING'
|
||||
: 'POLYGON';
|
||||
return { type, coordinates: geometry.coordinates };
|
||||
}
|
||||
|
||||
export function upsertAssetGeometry(assetId: string, input: {
|
||||
geometry: GeoJsonGeometry;
|
||||
accuracyM?: number | null;
|
||||
@@ -2169,7 +2178,7 @@ export function upsertAssetGeometry(assetId: string, input: {
|
||||
deviceLabel?: string | null;
|
||||
}) {
|
||||
return apiRequest<AssetGeometry>(`/assets/${assetId}/geometry`, {
|
||||
method: 'PUT', body: JSON.stringify(input),
|
||||
method: 'PUT', body: JSON.stringify({ ...input, geometry: geometryPayload(input.geometry) }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user