property management angefangen

This commit is contained in:
2026-08-18 23:57:00 +02:00
parent 7813e3f3c5
commit 4fe9756920
49 changed files with 711 additions and 564 deletions
@@ -0,0 +1,60 @@
import ky from 'ky'
import type { PropertyTypeGroup } from '../data/propertyTypeGroupTable'
const API_BASE_URL = 'http://localhost:8088'
type ApiResponse<T> = {
message: string;
data: T;
}
type ParentGroupsResponse = {
message: string;
parentId: number;
data: PropertyTypeGroup[];
}
export async function createPropertyTypeGroup(propertyTypeGroup: PropertyTypeGroup): Promise<PropertyTypeGroup> {
const response = await ky
.post(`${API_BASE_URL}/createPropertyTypeGroup`, { json: propertyTypeGroup })
.json<ApiResponse<PropertyTypeGroup>>()
return response.data
}
export async function updatePropertyTypeGroup(propertyTypeGroup: PropertyTypeGroup): Promise<PropertyTypeGroup> {
const response = await ky
.put(`${API_BASE_URL}/updatePropertyTypeGroup`, { json: propertyTypeGroup })
.json<ApiResponse<PropertyTypeGroup>>()
return response.data
}
export async function deletePropertyTypeGroup(id: number): Promise<number> {
const response = await ky
.delete(`${API_BASE_URL}/deletePropertyTypeGroup/${id}`)
.json<ApiResponse<number>>()
return response.data
}
export async function getPropertyTypeGroup(id: number): Promise<PropertyTypeGroup> {
const response = await ky
.get(`${API_BASE_URL}/getPropertyTypeGroup/${id}`)
.json<ApiResponse<PropertyTypeGroup>>()
return response.data
}
export async function getPropertyTypeGroupsByParentId(parentId: number): Promise<PropertyTypeGroup[]> {
const response = await ky
.get(`${API_BASE_URL}/getPropertyTypeGroupsByParentId/${parentId}`)
.json<ParentGroupsResponse>()
return response.data
}
export async function deletePropertyTypeFromPropertyTypeGroupId(propertyTypeGroupId: number): Promise<void> {
await ky.delete(`${API_BASE_URL}/deletePropertyTypeFromPropertyTypeGroupId/${propertyTypeGroupId}`)
}
@@ -5,7 +5,7 @@ import Typography from '@mui/material/Typography';
const Properties: React.FC = () => {
return (
<Box component="section" sx={{ p: 2, border: '1px dashed grey' }}>
<Typography variant="h3">
<Typography variant="body1" gutterBottom>
Property Type Management
</Typography>
<Box
@@ -17,7 +17,7 @@ const Properties: React.FC = () => {
bgcolor: "#f5f5f5"
}}
>
</Box>
</Box>
);
@@ -0,0 +1,6 @@
export type PropertyType = {
id: number;
label: string;
description: string;
propertyGroupId: number;
};
@@ -0,0 +1,6 @@
export type PropertyTypeGroup = {
id: number;
label: string;
description: string;
parentGroupId: number;
};