Make device sync atomic and undoable

This commit is contained in:
2026-07-22 19:47:10 +02:00
parent 6f8b292b6b
commit b2f5ce77a5
11 changed files with 481 additions and 65 deletions
+33 -2
View File
@@ -10,7 +10,10 @@ import type {
FloorDto,
GlobalDeviceDto,
ProjectDeviceDto,
ProjectDeviceDisconnectResultDto,
ProjectDeviceSyncPreviewDto,
ProjectDeviceSyncRestoreRowDto,
ProjectDeviceSyncResultDto,
ProjectDto,
RoomDto,
UpdateConsumerInput,
@@ -300,7 +303,7 @@ export function synchronizeProjectDeviceRows(
rowIds: string[],
fields: ProjectDeviceSyncField[]
) {
return request<ProjectDeviceSyncPreviewDto>(
return request<ProjectDeviceSyncResultDto>(
`/api/project-devices/projects/${projectId}/${projectDeviceId}/synchronize`,
{
method: "POST",
@@ -314,7 +317,7 @@ export function disconnectProjectDeviceRows(
projectDeviceId: string,
rowIds: string[]
) {
return request<{ disconnectedRowIds: string[] }>(
return request<ProjectDeviceDisconnectResultDto>(
`/api/project-devices/projects/${projectId}/${projectDeviceId}/disconnect`,
{
method: "POST",
@@ -322,3 +325,31 @@ export function disconnectProjectDeviceRows(
}
);
}
export function restoreProjectDeviceRows(
projectId: string,
projectDeviceId: string,
rows: ProjectDeviceSyncRestoreRowDto[]
) {
return request<ProjectDeviceSyncPreviewDto>(
`/api/project-devices/projects/${projectId}/${projectDeviceId}/restore`,
{
method: "POST",
body: JSON.stringify({ rows }),
}
);
}
export function reconnectProjectDeviceRows(
projectId: string,
projectDeviceId: string,
rowIds: string[]
) {
return request<ProjectDeviceSyncPreviewDto>(
`/api/project-devices/projects/${projectId}/${projectDeviceId}/reconnect`,
{
method: "POST",
body: JSON.stringify({ rowIds }),
}
);
}