forked from jappel/leistungsbilanz-ts
Persist project locations
This commit is contained in:
parent
1cf26a932e
commit
ac465a1cc0
23 changed files with 1313 additions and 101 deletions
|
|
@ -106,6 +106,11 @@ export interface FloorDto {
|
|||
sortOrder: number;
|
||||
}
|
||||
|
||||
export interface ProjectFloorCommandResultDto
|
||||
extends ProjectCommandResultDto {
|
||||
floor: FloorDto;
|
||||
}
|
||||
|
||||
export interface RoomDto {
|
||||
id: string;
|
||||
projectId: string;
|
||||
|
|
@ -146,6 +151,11 @@ export interface ProjectDeviceDto {
|
|||
voltageV: number | null;
|
||||
}
|
||||
|
||||
export interface ProjectRoomCommandResultDto
|
||||
extends ProjectCommandResultDto {
|
||||
room: RoomDto;
|
||||
}
|
||||
|
||||
export interface ProjectDeviceCommandResultDto
|
||||
extends ProjectCommandResultDto {
|
||||
projectDevice: ProjectDeviceDto;
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@ import type {
|
|||
ProjectCommandResultDto,
|
||||
ProjectDeviceCommandResultDto,
|
||||
ProjectDeviceDto,
|
||||
ProjectFloorCommandResultDto,
|
||||
ProjectHistoryStateDto,
|
||||
ProjectRevisionPageDto,
|
||||
ProjectSnapshotMetadataDto,
|
||||
ProjectSnapshotRestoreResultDto,
|
||||
ProjectSettingsCommandResultDto,
|
||||
ProjectRoomCommandResultDto,
|
||||
ProjectDeviceSyncCommandResultDto,
|
||||
ProjectDeviceSyncPreviewDto,
|
||||
ProjectDto,
|
||||
|
|
@ -454,22 +456,36 @@ export function listFloors(projectId: string) {
|
|||
return request<FloorDto[]>(`/api/projects/${projectId}/floors`);
|
||||
}
|
||||
|
||||
export function createFloor(projectId: string, input: CreateFloorInput) {
|
||||
return request<FloorDto>(`/api/projects/${projectId}/floors`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
export function createFloor(
|
||||
projectId: string,
|
||||
input: CreateFloorInput,
|
||||
expectedRevision: number
|
||||
) {
|
||||
return request<ProjectFloorCommandResultDto>(
|
||||
`/api/projects/${projectId}/floors`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ...input, expectedRevision }),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function listRooms(projectId: string) {
|
||||
return request<RoomDto[]>(`/api/projects/${projectId}/rooms`);
|
||||
}
|
||||
|
||||
export function createRoom(projectId: string, input: CreateRoomInput) {
|
||||
return request<RoomDto>(`/api/projects/${projectId}/rooms`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
export function createRoom(
|
||||
projectId: string,
|
||||
input: CreateRoomInput,
|
||||
expectedRevision: number
|
||||
) {
|
||||
return request<ProjectRoomCommandResultDto>(
|
||||
`/api/projects/${projectId}/rooms`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ...input, expectedRevision }),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function listGlobalDevices() {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ const commandTypeLabels: Record<string, string> = {
|
|||
"project.update-settings": "Projekteinstellungen bearbeitet",
|
||||
"distribution-board.insert": "Verteilung angelegt",
|
||||
"distribution-board.delete": "Verteilung entfernt",
|
||||
"project-floor.insert": "Geschoss angelegt",
|
||||
"project-floor.delete": "Geschoss entfernt",
|
||||
"project-room.insert": "Raum angelegt",
|
||||
"project-room.delete": "Raum entfernt",
|
||||
"project.restore-state": "Projektstand wiederhergestellt",
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue