Add editable project floors and rooms
This commit is contained in:
parent
1e3c721cfa
commit
1eed19ef6b
15 changed files with 743 additions and 80 deletions
|
|
@ -786,6 +786,25 @@ export function createFloor(
|
|||
);
|
||||
}
|
||||
|
||||
export function updateFloor(
|
||||
projectId: string,
|
||||
floorId: string,
|
||||
input: CreateFloorInput,
|
||||
expectedRevision: number
|
||||
) {
|
||||
return request<ProjectFloorCommandResultDto>(`/api/projects/${projectId}/floors/${floorId}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ ...input, expectedRevision }),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteFloor(projectId: string, floorId: string, expectedRevision: number) {
|
||||
return request<ProjectCommandResultDto>(`/api/projects/${projectId}/floors/${floorId}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify({ expectedRevision }),
|
||||
});
|
||||
}
|
||||
|
||||
export function listRooms(projectId: string) {
|
||||
return request<RoomDto[]>(`/api/projects/${projectId}/rooms`);
|
||||
}
|
||||
|
|
@ -804,6 +823,25 @@ export function createRoom(
|
|||
);
|
||||
}
|
||||
|
||||
export function updateRoom(
|
||||
projectId: string,
|
||||
roomId: string,
|
||||
input: CreateRoomInput,
|
||||
expectedRevision: number
|
||||
) {
|
||||
return request<ProjectRoomCommandResultDto>(`/api/projects/${projectId}/rooms/${roomId}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ ...input, floorId: input.floorId ?? null, expectedRevision }),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteRoom(projectId: string, roomId: string, expectedRevision: number) {
|
||||
return request<ProjectCommandResultDto>(`/api/projects/${projectId}/rooms/${roomId}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify({ expectedRevision }),
|
||||
});
|
||||
}
|
||||
|
||||
export function listGlobalDevices() {
|
||||
return request<GlobalDeviceDto[]>("/api/global-devices");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue