pre updating version control
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { API_ENDPOINTS } from "@/api/config";
|
||||
import { EntityBatchChange } from "@/api/entities";
|
||||
import { requestJson } from "@/api/http";
|
||||
import { Change, FeatureCollection, Geometry } from "@/lib/useEditorState";
|
||||
|
||||
@@ -40,6 +41,14 @@ export type BatchSaveResponse = {
|
||||
applied: number;
|
||||
};
|
||||
|
||||
export type CombinedBatchSaveResponse = {
|
||||
success: boolean;
|
||||
applied: number;
|
||||
entity_applied: number;
|
||||
geometry_applied: number;
|
||||
created_entity_ids: string[];
|
||||
};
|
||||
|
||||
function buildBBoxQueryString(params: GeometriesBBoxQuery): string {
|
||||
const query = new URLSearchParams({
|
||||
minLng: String(params.minLng),
|
||||
@@ -72,6 +81,20 @@ export async function saveGeometryBatchChanges(changes: Change[]): Promise<Batch
|
||||
});
|
||||
}
|
||||
|
||||
export async function saveCombinedGeometryEntityBatchChanges(
|
||||
entityChanges: EntityBatchChange[],
|
||||
geometryChanges: Change[]
|
||||
): Promise<CombinedBatchSaveResponse> {
|
||||
return requestJson<CombinedBatchSaveResponse>(API_ENDPOINTS.geometriesBatchCombined, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
entity_changes: entityChanges,
|
||||
geometry_changes: geometryChanges,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function createGeometry(payload: GeometryCreatePayload): Promise<GeometryCreateResponse> {
|
||||
return requestJson<GeometryCreateResponse>(API_ENDPOINTS.geometries, {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user