db abfrage baukosten

This commit is contained in:
Cay 2026-03-12 14:14:48 +00:00
parent a17bc832b0
commit 8b23584aa0

4
app.js
View File

@ -95,7 +95,7 @@ app.get("/api/building/:id", async (req, res) => {
} }
const [nextLevel] = await db.query( const [nextLevel] = await db.query(
"SELECT required_points FROM building_levels WHERE building_id=? AND level=?", "SELECT required_points, wood, stone FROM building_levels WHERE building_id=? AND level=?",
[buildingId, building.level + 1], [buildingId, building.level + 1],
); );
@ -111,7 +111,7 @@ app.get("/api/building/:id", async (req, res) => {
nextLevelPoints: nextLevel[0]?.required_points || null, nextLevelPoints: nextLevel[0]?.required_points || null,
description: info[0].description, description: info[0].description,
history: info[0].history, history: info[0].history,
upgradeCost: "500 Holz, 200 Stein", upgradeCost: `${nextLevel[0]?.wood} Holz, ${nextLevel[0]?.stone} Stein`,
}); });
} catch (err) { } catch (err) {
console.error(err); console.error(err);