git commit -m "feat: Mock-API über /api/mockData/webService erfolgreich implementiert 🚀

- JSON-Dateien aus /webServiceMockdata als echte API-Mocks verfügbar
- API-Endpunkte unter /api/mockData/webService/ hinzugefügt
- Fehlerhafte Platzhalter in den API-Handlern korrigiert
- Alle Mock-URLs in config.js auf die neuen API-Routen umgestellt
- Tests erfolgreich durchgeführt, Mock-API funktioniert einwandfrei"
This commit is contained in:
ISA
2025-03-07 10:01:18 +01:00
parent aa218b1c96
commit c6269b75a3
34 changed files with 59746 additions and 11 deletions

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "CablesStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading CablesStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GetIconsStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GetIconsStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsMeasurementsMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisStationsMeasurementsMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStaticDistrictMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisStationsStaticDistrictMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisStationsStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStatusDistrictMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisStationsStatusDistrictMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStatusMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisStationsStatusMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisSystemStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading GisSystemStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "KueStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading KueStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "KueStatusMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading KueStatusMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "ServicesStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading ServicesStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "StationsStaticMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading StationsStaticMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "StationsStatusMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading StationsStatusMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}

View File

@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
export default function handler(req, res) {
const filePath = path.join(process.cwd(), "webServiceMockdata", "StatusTALASMock.json");
try {
const fileContent = fs.readFileSync(filePath, "utf8");
const data = JSON.parse(fileContent);
res.status(200).json(data);
} catch (error) {
console.error(`Error reading StatusTALASMock.json:`, error);
res.status(500).json({ message: "Error loading mock data" });
}
}