polylines tooltip content

This commit is contained in:
ISA
2024-08-10 10:32:37 +02:00
parent b1f7b700ca
commit b7116a1e6f
142 changed files with 14451 additions and 4281 deletions

View File

@@ -0,0 +1,45 @@
// pages/api/talas_v5_DB/pois/deletePoi.js
import mysql from "mysql";
// Datenbankkonfiguration
const dbConfig = {
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
port: process.env.DB_PORT,
};
const connection = mysql.createConnection(dbConfig);
connection.connect((err) => {
if (err) {
console.error("Fehler beim Verbinden:", err.stack);
return;
}
console.log("Verbunden als ID", connection.threadId);
});
export default function handler(req, res) {
if (req.method !== "DELETE") {
return res.status(405).json({ error: "Nur DELETE Methode erlaubt" });
}
const { id } = req.query; // ID aus der Anfrage holen
if (!id) {
return res.status(400).json({ error: "POI ID ist erforderlich" });
}
const query = "DELETE FROM poi WHERE idPoi = ?";
connection.query(query, [id], (error, results) => {
if (error) {
console.error("Fehler beim Löschen des POI:", error);
return res.status(500).json({ error: "Fehler beim Löschen des POI" });
}
if (results.affectedRows > 0) {
res.json({ message: "POI erfolgreich gelöscht" });
} else {
res.status(404).json({ error: "POI nicht gefunden" });
}
});
}