docs: Markdown-Dokumentation für alle Services erstellt und in /docs/services/ abgelegt (v1.1.122)

This commit is contained in:
ISA
2025-05-20 15:22:04 +02:00
parent 4c94ba82ae
commit a081a94731
13 changed files with 99 additions and 85 deletions

View File

@@ -4,6 +4,41 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie
--- ---
## [1.1.122] 2025-05-20
### Documentation
- 📄 Für alle Service-Dateien wurde Markdown-Dokumentation erstellt (`/docs/services/`)
- Jede `.md`-Datei enthält:
- Kurzbeschreibung der Funktion
- Beschreibung der URL-Parameter und Rückgabewerte
- Zweck im Projektkontext
- Exportiert als ZIP zur Weitergabe und Integration
### Strukturierte Services dokumentiert:
- WebServices:
- `fetchGisStationsMeasurementsService`
- `fetchGisStationsStaticDistrictService`
- `fetchGisStationsStatusDistrictService`
- `fetchGisStatusStationsService`
- `fetchGisSystemStaticService`
- `fetchUserRightsService`
- Datenbank-APIs:
- `fetchDeviceNameByIdService`
- `fetchPoiDataService`
- `updateLocationInDatabaseService`
- Utilities:
- `fetchWithTimeout`
### Motivation
- 🧠 Klare Trennung zwischen Logik und Dokumentation
- 📦 Unterstützt Wartung, Teamarbeit und Onboarding
- ✅ Dokumentation vollständig unabhängig vom Code nutzbar
---
## [1.1.120] 2025-05-20 ## [1.1.120] 2025-05-20
### Refactor ### Refactor

View File

@@ -1,2 +1,2 @@
// /config/appVersion // /config/appVersion
export const APP_VERSION = "1.1.121"; export const APP_VERSION = "1.1.122";

View File

@@ -1,84 +0,0 @@
# 🛰️ fetchGisStatusStations Geräte-Statusdaten abrufen
## Zweck
Diese Funktion ruft den aktuellen Status aller Stationen (Geräte) für eine bestimmte Karte ab.
Sie basiert auf dem Webservice `GisStationsStatusDistrict`.
---
## Webservice-Endpunkt
```
GET /talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap={idMap}&idUser={idUser}
```
---
## Dynamische URL-Erzeugung
Die Funktion nutzt **keine feste URL** aus `.env.local`, sondern erkennt die Umgebung anhand von:
```env
NEXT_PUBLIC_API_PORT_MODE=dev
```
### Beispiel aus dem Code:
```js
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const SERVER_URL =
mode === "dev"
? \`\${window.location.protocol}//\${window.location.hostname}:80\`
: \`\${window.location.origin}\`;
```
---
## Parameter
| Name | Typ | Beschreibung |
|----------|--------|--------------------------|
| `idMap` | string | Karten-ID |
| `idUser` | string | Benutzer-ID |
---
## Verwendung
Die Funktion nutzt `fetchWithTimeout` mit einem Timeout von 5000ms.
```js
fetchWithTimeout(
\`\${SERVER_URL}/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=\${idMap}&idUser=\${idUser}\`,
{ method: "GET", headers: { Connection: "close" } },
5000
)
```
---
## Fehlerbehandlung
Bei HTTP-Fehlern oder Zeitüberschreitung wird ein Fehler geloggt und erneut geworfen.
```js
if (!response.ok) throw new Error(...);
.catch((error) => {
console.error(...);
throw error;
});
```
---
## Siehe auch
- `.env.local``NEXT_PUBLIC_API_PORT_MODE`
- `fetchWithTimeout.js`
- `GisStationsStaticDistrict`, `GisSystemStatic`
---
📄 Pfad: `/docs/frontend/services/api/fetchGisStatusStations.md`

View File

@@ -0,0 +1,5 @@
# fetchDeviceNameByIdService
Liest Gerätenamen über die eigene Next.js-API.
**Route:** `/api/talas_v5_DB/locationDevice/locationDeviceNameById?idLD={idLD}`

View File

@@ -0,0 +1,5 @@
# fetchPoiDataService
Lädt POI-Daten über API `/api/talas_v5_DB/pois/getPoiById?idPoi={idPoi}`
- Rückgabe: Objekt mit POI-Infos (id, name, description, idLD)

View File

@@ -0,0 +1,6 @@
# updateLocationInDatabaseService
Aktualisiert die Position eines POIs in der Datenbank.
- Methode: `POST`
- Route: `/api/talas_v5_DB/pois/updateLocation`

View File

@@ -0,0 +1,6 @@
# fetchWithTimeout
Hilfsfunktion für Fetch mit Abbruch bei Timeout.
- Parameter: URL, Optionen, Timeout (default: 5000ms)
- Nutzt `AbortController`

View File

@@ -0,0 +1,8 @@
# fetchGisStationsMeasurementsService
Lädt GIS-Messwerte über den TALAS WebService.
**URL-Aufbau:** `/ClientData/WebServiceMap.asmx/GisStationsMeasurements?idMap={idMap}&idUser={idUser}`
- Holt Daten direkt basierend auf der URL (?m= & ?u=).
- Rückgabewert: `Statis[]`

View File

@@ -0,0 +1,8 @@
# fetchGisStationsStaticDistrictService
Lädt GIS-Stationen (statisch) für Bezirke.
**Rückgabe:** `Points[]`
- Holt `idMap` und `idUser` aus der URL.
- WebService: `GisStationsStaticDistrict`

View File

@@ -0,0 +1,7 @@
# fetchGisStationsStatusDistrictService
Lädt den Status der GIS-Bezirksstationen.
**Rückgabe:** `Statis[]`
- Nutzt die WebService-URL `GisStationsStatusDistrict`.

View File

@@ -0,0 +1,6 @@
# fetchGisStatusStationsService
Lädt GIS-Statusdaten mit Timeout.
- Erwartet `idMap` und `idUser` als Parameter.
- Nutzt `fetchWithTimeout` mit 5s-Abbruchlogik.

View File

@@ -0,0 +1,6 @@
# fetchGisSystemStaticService
Lädt Systemübersicht vom GIS WebService.
- Rückgabe: `Systems[]`
- Liest `?m` und `?u` aus der URL.

View File

@@ -0,0 +1,6 @@
# fetchUserRightsService
Lädt Benutzerrechte über WebService.
- Falls `USE_MOCK_API` gesetzt ist → werden Fake-Daten zurückgegeben.
- Rückgabe: Liste von `IdRight`