docs: Webservice-ID-Parameter über URL statt .env.local (BREAKING CHANGE)
- Entfernt Fallback für idMap und idUser via .env.local - Anpassung aller fetchGis*-Funktionen zur Nutzung von URL-Parametern - Dokumentation entsprechend aktualisiert - CHANGELOG.md hinzugefügt (Version 1.1.65)
This commit is contained in:
22
CHANGELOG.md
Normal file
22
CHANGELOG.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# 📄 CHANGELOG
|
||||
|
||||
Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentiert.
|
||||
|
||||
---
|
||||
|
||||
## [1.1.65] – 2025-05-15
|
||||
|
||||
### Changed
|
||||
|
||||
- `idMap` und `idUser` werden nicht mehr aus `.env.local` gelesen, sondern ausschließlich über die URL übergeben (z. B. von TALAS.web).
|
||||
- Entfernt: Fallback-Variablen `NEXT_PUBLIC_DEFAULT_ID_MAP` und `NEXT_PUBLIC_DEFAULT_ID_USER`.
|
||||
- Dokumentation in `docs/redux/api/fromWebService.md` entsprechend angepasst.
|
||||
|
||||
---
|
||||
|
||||
## [1.1.64] – 2025-05-15
|
||||
|
||||
### Added
|
||||
|
||||
- Erste Dokumentation der Webservice-Endpunkte in `docs/api/webservices.md`.
|
||||
- Projektstruktur in `docs/` vorbereitet für spätere Erweiterung.
|
||||
@@ -1,2 +1,2 @@
|
||||
// /config/appVersion
|
||||
export const APP_VERSION = "1.1.65";
|
||||
export const APP_VERSION = "1.1.66";
|
||||
|
||||
@@ -1,101 +1,72 @@
|
||||
# 📡 Webservices – TALAS / GIS
|
||||
# 📡 Webservices – Redux Integration (/redux/api/fromWebService)
|
||||
|
||||
## Basis-URL
|
||||
In diesem Verzeichnis befinden sich alle Webservice-Fetch-Funktionen für die Kommunikation mit TALAS.web über SOAP-Endpunkte.
|
||||
|
||||
```env
|
||||
NEXT_PUBLIC_API_BASE_URL=http://[DNS-Name-oder-IP]/[pfad]
|
||||
# Beispiel: http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx
|
||||
---
|
||||
|
||||
## Aktueller Stand
|
||||
|
||||
Jede Funktion liest `idMap` und `idUser` **ausschließlich aus der URL**, wie sie von TALAS.web übergeben werden.
|
||||
|
||||
Beispiel:
|
||||
|
||||
```ts
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Endpunkte
|
||||
## Änderung am 2025-05-15
|
||||
|
||||
### 1. `GisStationsStatic`
|
||||
Vorher wurden Default-Werte über `.env.local` als Fallback genutzt:
|
||||
|
||||
- **Beschreibung:** Statische Geräteliste einer Karte
|
||||
- **Methode:** GET
|
||||
- **Parameter:** `idMap`
|
||||
- **Beispiel:**
|
||||
```ts
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
```
|
||||
|
||||
```
|
||||
GET /GisStationsStatic?idMap=12
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStatic?idMap=12
|
||||
Das wurde entfernt, um folgende Ziele zu erreichen:
|
||||
|
||||
```
|
||||
- ❌ Keine fest eingetragenen Defaults im Browser sichtbar
|
||||
- ✅ Verbindlichkeit: TALAS.web übergibt die Werte immer korrekt via URL
|
||||
- 🔐 Sicherheit: Kein versehentliches Verwenden eines falschen Users (z. B. ID 484)
|
||||
- 🔍 Fehler leichter erkennbar (Parameter nicht gefunden = echter Fehler)
|
||||
|
||||
---
|
||||
|
||||
### 2. `GisStationsStaticDistrict`
|
||||
## Optional: Validierung einbauen
|
||||
|
||||
- **Beschreibung:** Statische Geräte inkl. Bereichszuordnung
|
||||
- **Methode:** GET
|
||||
- **Parameter:** `idMap`, `idUser`
|
||||
- **Beispiel:**
|
||||
```
|
||||
GET /GisStationsStaticDistrict?idMap=12&idUser=484
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=12&idUser=484
|
||||
```
|
||||
Falls gewünscht, kann ein expliziter Fehler ausgelöst werden:
|
||||
|
||||
```ts
|
||||
if (!idMap || !idUser) {
|
||||
throw new Error("Fehlende URL-Parameter: idMap oder idUser");
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. `GisStationsStatusDistrict`
|
||||
## Betroffene Dateien
|
||||
|
||||
- **Beschreibung:** Aktueller Status von Geräten im Gebiet
|
||||
- **Methode:** GET
|
||||
- **Parameter:** `idMap`, `idUser`
|
||||
- **Beispiel:**
|
||||
```
|
||||
GET /GisStationsStatusDistrict?idMap=12&idUser=484
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=12&idUser=484
|
||||
```
|
||||
Diese Änderung betrifft alle Funktionen in:
|
||||
|
||||
```
|
||||
/redux/api/fromWebService/fetchGisStationsStatic.js
|
||||
/redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
||||
/redux/api/fromWebService/fetchGisStationsStatusDistrict.js
|
||||
/redux/api/fromWebService/fetchGisStationsMeasurements.js
|
||||
/redux/api/fromWebService/fetchGisSystemStatic.js
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4. `GisStationsMeasurements`
|
||||
## Hinweis zur Konfiguration
|
||||
|
||||
- **Beschreibung:** Live-Messwerte der Geräte
|
||||
- **Methode:** GET
|
||||
- **Parameter:** `idMap`, `idUser`
|
||||
- **Beispiel:**
|
||||
```
|
||||
GET /GisStationsMeasurements?idMap=12&idUser=484
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsMeasurements?idMap=12&idUser=484
|
||||
```
|
||||
Die Webservice-Basisadresse wird weiterhin über `.env.local` konfiguriert:
|
||||
|
||||
---
|
||||
```env
|
||||
NEXT_PUBLIC_API_BASE_URL=http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx
|
||||
```
|
||||
|
||||
### 5. `GisSystemStatic`
|
||||
|
||||
- **Beschreibung:** Liste aller Systeme auf der Karte
|
||||
- **Methode:** GET
|
||||
- **Parameter:** `idMap`, `idUser`
|
||||
- **Beispiel:**
|
||||
```
|
||||
GET /GisSystemStatic?idMap=12&idUser=484
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisSystemStatic?idMap=12&idUser=484
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Nutzung im Code
|
||||
|
||||
- Alle Webservice-Aufrufe basieren auf:
|
||||
```js
|
||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
```
|
||||
- Fallback-IDs über `.env.local`:
|
||||
```env
|
||||
NEXT_PUBLIC_DEFAULT_ID_MAP=12
|
||||
NEXT_PUBLIC_DEFAULT_ID_USER=484
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Hinweise
|
||||
|
||||
- ❌ Keine festen IPs/Domains in Code-Dateien verwenden
|
||||
- ✅ Nur `.env.local` als zentrale Konfiguration nutzen
|
||||
- ✅ Beispielaufrufe ausschließlich in dieser Datei dokumentieren
|
||||
- ✅ Webservice-Funktionen befinden sich in:
|
||||
`/redux/api/fromWebService/fetchGis*.js`
|
||||
Aber `idMap` und `idUser` werden **nicht** mehr über Umgebungsvariablen gesteuert.
|
||||
|
||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
|
||||
export const fetchGisStationsMeasurements = async () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
|
||||
//console.log("🔍 fetchGisStationsMeasurements - URL:", `${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
export const fetchGisStationsStatic = async () => {
|
||||
try {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
const response = await fetch(`${apiBaseUrl}/GisStationsStatic?idMap=${idMap}`);
|
||||
|
||||
//console.log("📡 API Response Status:", response.status);
|
||||
|
||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
|
||||
export const fetchGisStationsStaticDistrict = async () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
|
||||
// console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
|
||||
export const fetchGisStationsStatusDistrict = async () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
|
||||
//console.log("🔍 fetchGisStationsStatusDistrict - URL:", `${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||
|
||||
export async function fetchGisSystemStatic() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||
const idMap = params.get("idMap");
|
||||
const idUser = params.get("idUser");
|
||||
|
||||
//console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user