fix: Parameter "m" und "u" in Front- und Backend und Parameter idMap und idUser entfernen für Webservices
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -28,3 +28,5 @@ nodeMap für 13 am 16.07.2024.zip
|
|||||||
Lastenheft.js
|
Lastenheft.js
|
||||||
# Dendron-Verzeichnis ignorieren
|
# Dendron-Verzeichnis ignorieren
|
||||||
/draw.io/
|
/draw.io/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.66";
|
export const APP_VERSION = "1.1.67";
|
||||||
|
|||||||
40
docs/checklist.md
Normal file
40
docs/checklist.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# 🧾 Projektpflege-Checkliste
|
||||||
|
|
||||||
|
Diese Datei dient als persönliche Gedächtnisstütze bei der Entwicklung und Pflege des Projekts.
|
||||||
|
|
||||||
|
Bevor du einen Feature-, Refactor- oder Bugfix-Commit abschließt, geh diese Liste durch:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Dokumentation
|
||||||
|
|
||||||
|
- [ ] Ist `README.md` noch aktuell (Projektziel, Setup, Nutzung)?
|
||||||
|
- [ ] Wurde `CHANGELOG.md` ergänzt (mit Datum, Version, Änderung)?
|
||||||
|
- [ ] Wurde ggf. ein neuer Punkt in `/docs/` ergänzt oder aktualisiert?
|
||||||
|
- [ ] Sind Beispiel-URLs oder sensible Daten **nicht im Code**, sondern dokumentiert?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Konfiguration
|
||||||
|
|
||||||
|
- [ ] Ist `.env.local` aktuell und vollständig (für Entwickler/Testserver)?
|
||||||
|
- [ ] Wird jede Konfiguration ausschließlich über `.env.local` gesteuert?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Codequalität & Git
|
||||||
|
|
||||||
|
- [ ] Ist die Git-Commit-Message beschreibend und lesbar (z. B. `feat:`, `fix:`, `docs:`)?
|
||||||
|
- [ ] Wurden unnötige Debug-Logs entfernt oder per `NODE_ENV` abgesichert?
|
||||||
|
- [ ] Wurden Änderungen getestet (lokal, ggf. auf Testsystem)?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧭 Onboarding-freundlich?
|
||||||
|
|
||||||
|
- [ ] Könnte ein neuer Entwickler mit den aktuellen Dokumenten verstehen, was wie funktioniert?
|
||||||
|
- [ ] Gibt es Hinweise zur Architektur, API-Flows oder Besonderheiten im Code?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Du kannst diese Checkliste in jedem Projekt beibehalten und auf deine Arbeitsweise anpassen.
|
||||||
67
docs/frontend/pages/api.md
Normal file
67
docs/frontend/pages/api.md
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# 📘 API-Routen in `/pages/api/`
|
||||||
|
|
||||||
|
Dieses Dokument beschreibt die internen API-Routen der Anwendung (Next.js API Routes) und erklärt die verwendeten URL-Parameter sowie Konventionen bei der Nutzung im Backend.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔗 Übergabeparameter aus TALAS.web
|
||||||
|
|
||||||
|
Beim Aufruf der Anwendung über TALAS.web werden die folgenden URL-Parameter übergeben:
|
||||||
|
|
||||||
|
| Parameter | Bedeutung | Verwendung im Code |
|
||||||
|
|-----------|------------------|---------------------------|
|
||||||
|
| `m` | Map-ID (`idMap`) | `req.query.m` |
|
||||||
|
| `u` | User-ID (`idUser`)| `req.query.u` |
|
||||||
|
|
||||||
|
> ⚠️ Es wird bewusst **nicht** `idMap` oder `idUser` verwendet, da TALAS mit Kurzparametern arbeitet.
|
||||||
|
|
||||||
|
### Beispiel:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const idMap = req.query.m;
|
||||||
|
const idUser = req.query.u;
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠 Zweck des Verzeichnisses `/pages/api/`
|
||||||
|
|
||||||
|
Alle Dateien in diesem Verzeichnis definieren serverseitige Endpunkte. Diese:
|
||||||
|
|
||||||
|
- werden **nur auf dem Server ausgeführt**
|
||||||
|
- sind über `fetch('/api/...')` vom Frontend aufrufbar
|
||||||
|
- dienen als **Proxy zu SOAP-Webservices** oder **Zugriff auf die Datenbank**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📁 Beispiel: Aufruf eines Webservice
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GET /api/gisSystemStatic?m=10&u=484
|
||||||
|
```
|
||||||
|
|
||||||
|
Dieser Request wird serverseitig weitergeleitet an:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://[SERVER]/talas5/ClientData/WebServiceMap.asmx/GisSystemStatic?idMap=10&idUser=484
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 Übersicht interner API-Routen
|
||||||
|
|
||||||
|
| API-Route | Beschreibung |
|
||||||
|
|----------------------------------|------------------------------------------|
|
||||||
|
| `/api/gisSystemStatic` | Proxy zu WebService GisSystemStatic |
|
||||||
|
| `/api/gisStationsStaticDistrict` | Geräte-Liste inkl. Bereich |
|
||||||
|
| `/api/gisStationsMeasurements` | Live-Messwerte der Geräte |
|
||||||
|
| `/api/talas_v5_DB/pois/readLocations` | POIs aus der Datenbank (MySQL) |
|
||||||
|
| `/api/talas_v5_DB/device/getAllStationsNames` | Gerätnamen aus DB |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔐 Sicherheitshinweis
|
||||||
|
|
||||||
|
- Kein sensibler Parameter darf hart codiert sein
|
||||||
|
- Alle Server-URLs werden über `.env.local` konfiguriert
|
||||||
|
- Nur `m` und `u` aus `req.query` verwenden – keine Fallbacks oder Defaults
|
||||||
@@ -8,12 +8,31 @@ In diesem Verzeichnis befinden sich alle Webservice-Fetch-Funktionen für die Ko
|
|||||||
|
|
||||||
Jede Funktion liest `idMap` und `idUser` **ausschließlich aus der URL**, wie sie von TALAS.web übergeben werden.
|
Jede Funktion liest `idMap` und `idUser` **ausschließlich aus der URL**, wie sie von TALAS.web übergeben werden.
|
||||||
|
|
||||||
Beispiel:
|
---
|
||||||
|
|
||||||
|
## Übergabe der Parameter über URL (`m`, `u`)
|
||||||
|
|
||||||
|
TALAS.web ruft die Kartenansicht in der Regel so auf:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://localhost:3000/?m=10&u=484
|
||||||
|
```
|
||||||
|
|
||||||
|
Daraus ergeben sich folgende Zuweisungen:
|
||||||
|
|
||||||
|
| URL-Parameter | Bedeutung | Variable im Code |
|
||||||
|
| ------------- | --------- | -------------------------------- |
|
||||||
|
| `m` | `idMap` | `const idMap = params.get("m")` |
|
||||||
|
| `u` | `idUser` | `const idUser = params.get("u")` |
|
||||||
|
|
||||||
|
🔔 Achtung: Diese Kurzform (`m`, `u`) ist systembedingt durch TALAS.web vorgegeben und **soll nicht durch `idMap` oder `idUser` ersetzt werden**, da die Parameter sonst nicht erkannt werden.
|
||||||
|
|
||||||
|
### Beispiel:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("idMap");
|
const idMap = params.get("m"); // statt "idMap"
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u"); // statt "idUser"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Parameter aus URL oder Fallback-Werte verwenden
|
// Parameter aus URL oder Fallback-Werte verwenden
|
||||||
const idMap = req.query.m || req.query.idMap; // 'm' = idMap
|
const idMap = req.query.m; // 'm' = idMap
|
||||||
|
|
||||||
// Überprüfung, ob idMap fehlt
|
// Überprüfung, ob idMap fehlt
|
||||||
if (!idMap) {
|
if (!idMap) {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Parameter aus URL oder Fallback-Werte verwenden
|
// Parameter aus URL oder Fallback-Werte verwenden
|
||||||
const idMap = req.query.m || req.query.idMap; // 'm' = idMap
|
const idMap = req.query.m; // 'm' = idMap
|
||||||
const idUser = req.query.u || req.query.idUser; // 'u' = idUser
|
const idUser = req.query.u; // 'u' = idUser
|
||||||
|
|
||||||
// Überprüfung, ob Parameter fehlen
|
// Überprüfung, ob Parameter fehlen
|
||||||
if (!idMap || !idUser) {
|
if (!idMap || !idUser) {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Parameter aus URL oder Fallback-Werte verwenden
|
// Parameter aus URL oder Fallback-Werte verwenden
|
||||||
const idMap = req.query.m || req.query.idMap; // 'm' = idMap
|
const idMap = req.query.m; // 'm' = idMap
|
||||||
const idUser = req.query.u || req.query.idUser; // 'u' = idUser
|
const idUser = req.query.u; // 'u' = idUser
|
||||||
|
|
||||||
// Überprüfung, ob Parameter fehlen
|
// Überprüfung, ob Parameter fehlen
|
||||||
if (!idMap || !idUser) {
|
if (!idMap || !idUser) {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Parameter aus URL oder Fallback-Werte verwenden
|
// Parameter aus URL oder Fallback-Werte verwenden
|
||||||
const idMap = req.query.m || req.query.idMap; // 'm' = idMap
|
const idMap = req.query.m; // 'm' = idMap
|
||||||
const idUser = req.query.u || req.query.idUser; // 'u' = idUser
|
const idUser = req.query.u; // 'u' = idUser
|
||||||
|
|
||||||
// Überprüfung, ob Parameter fehlen
|
// Überprüfung, ob Parameter fehlen
|
||||||
if (!idMap || !idUser) {
|
if (!idMap || !idUser) {
|
||||||
|
|||||||
@@ -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");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
//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");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u");
|
||||||
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,10 +4,10 @@ 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");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
// console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
const response = await fetch(`${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ 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");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
//console.log("🔍 fetchGisStationsStatusDistrict - URL:", `${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
console.log("🔍 fetchGisStationsStatusDistrict - URL:", `${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
const response = await fetch(`${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ 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");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("idUser");
|
const idUser = params.get("u");
|
||||||
|
//console.log("🔍 fetchGisSystemStatic - idMap:", idMap);
|
||||||
|
//console.log("🔍 fetchGisSystemStatic - idUser:", idUser);
|
||||||
//console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
//console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
const response = await fetch(`${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
const response = await fetch(`${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user