fix(api): align frontend with REST contracts

This commit is contained in:
2026-07-30 20:38:52 +08:00
parent b57e58ff87
commit 782363cfb6
65 changed files with 99362 additions and 318 deletions
@@ -6,7 +6,6 @@ import type {
} from "./types";
export interface OptimizeSchemeInput {
network: string;
scheme_name: string;
sensor_type: "pressure";
method: "sensitivity" | "kmeans";
@@ -18,25 +17,22 @@ export const optimizeSensorPlacement = async (
input: OptimizeSchemeInput,
): Promise<SensorPlacementScheme> => {
const response = await api.post<SensorPlacementScheme>(
`${config.BACKEND_URL}/api/v1/sensor-placement-schemes/optimize`,
`${config.BACKEND_URL}/api/v1/sensor-placement-optimization-runs`,
input,
);
return response.data;
};
export const getSensorPlacementScheme = async (
network: string,
schemeId: number,
): Promise<SensorPlacementScheme> => {
const response = await api.get<SensorPlacementScheme>(
`${config.BACKEND_URL}/api/v1/sensor-placement-schemes/${schemeId}`,
{ params: { network } },
);
return response.data;
};
export const overwriteSensorPlacementScheme = async (
network: string,
schemeId: number,
expectedSensorLocation: string[],
sensorLocation: string[],
@@ -47,13 +43,11 @@ export const overwriteSensorPlacementScheme = async (
expected_sensor_location: expectedSensorLocation,
sensor_location: sensorLocation,
},
{ params: { network } },
);
return response.data;
};
export const exportSensorPlacementExcel = async (
network: string,
schemeId: number,
sensorLocation: string[],
adjustmentStatus: Record<string, AdjustmentStatus>,
@@ -65,7 +59,6 @@ export const exportSensorPlacementExcel = async (
adjustment_status: adjustmentStatus,
},
{
params: { network },
responseType: "blob",
},
);