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
|
// /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
|
```ts
|
||||||
- **Methode:** GET
|
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||||
- **Parameter:** `idMap`
|
```
|
||||||
- **Beispiel:**
|
|
||||||
|
|
||||||
```
|
Das wurde entfernt, um folgende Ziele zu erreichen:
|
||||||
GET /GisStationsStatic?idMap=12
|
|
||||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStatic?idMap=12
|
|
||||||
|
|
||||||
```
|
- ❌ 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
|
Falls gewünscht, kann ein expliziter Fehler ausgelöst werden:
|
||||||
- **Methode:** GET
|
|
||||||
- **Parameter:** `idMap`, `idUser`
|
```ts
|
||||||
- **Beispiel:**
|
if (!idMap || !idUser) {
|
||||||
```
|
throw new Error("Fehlende URL-Parameter: idMap oder idUser");
|
||||||
GET /GisStationsStaticDistrict?idMap=12&idUser=484
|
}
|
||||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=12&idUser=484
|
```
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 3. `GisStationsStatusDistrict`
|
## Betroffene Dateien
|
||||||
|
|
||||||
- **Beschreibung:** Aktueller Status von Geräten im Gebiet
|
Diese Änderung betrifft alle Funktionen in:
|
||||||
- **Methode:** GET
|
|
||||||
- **Parameter:** `idMap`, `idUser`
|
```
|
||||||
- **Beispiel:**
|
/redux/api/fromWebService/fetchGisStationsStatic.js
|
||||||
```
|
/redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
||||||
GET /GisStationsStatusDistrict?idMap=12&idUser=484
|
/redux/api/fromWebService/fetchGisStationsStatusDistrict.js
|
||||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=12&idUser=484
|
/redux/api/fromWebService/fetchGisStationsMeasurements.js
|
||||||
```
|
/redux/api/fromWebService/fetchGisSystemStatic.js
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 4. `GisStationsMeasurements`
|
## Hinweis zur Konfiguration
|
||||||
|
|
||||||
- **Beschreibung:** Live-Messwerte der Geräte
|
Die Webservice-Basisadresse wird weiterhin über `.env.local` konfiguriert:
|
||||||
- **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
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
```env
|
||||||
|
NEXT_PUBLIC_API_BASE_URL=http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx
|
||||||
|
```
|
||||||
|
|
||||||
### 5. `GisSystemStatic`
|
Aber `idMap` und `idUser` werden **nicht** mehr über Umgebungsvariablen gesteuert.
|
||||||
|
|
||||||
- **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`
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
|||||||
|
|
||||||
export const fetchGisStationsMeasurements = async () => {
|
export const fetchGisStationsMeasurements = async () => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap");
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser");
|
||||||
|
|
||||||
//console.log("🔍 fetchGisStationsMeasurements - URL:", `${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${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 () => {
|
export const fetchGisStationsStatic = async () => {
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap");
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser");
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStatic?idMap=${idMap}`);
|
const response = await fetch(`${apiBaseUrl}/GisStationsStatic?idMap=${idMap}`);
|
||||||
|
|
||||||
//console.log("📡 API Response Status:", response.status);
|
//console.log("📡 API Response Status:", response.status);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
|||||||
|
|
||||||
export const fetchGisStationsStaticDistrict = async () => {
|
export const fetchGisStationsStaticDistrict = async () => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap");
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser");
|
||||||
|
|
||||||
// console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${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 () => {
|
export const fetchGisStationsStatusDistrict = async () => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap");
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser");
|
||||||
|
|
||||||
//console.log("🔍 fetchGisStationsStatusDistrict - URL:", `${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${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() {
|
export async function fetchGisSystemStatic() {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap");
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser");
|
||||||
|
|
||||||
//console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
//console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user