Skip to content

Commit

Permalink
refactor reset-wind-history endpoint to improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bluescorpian committed Mar 4, 2025
1 parent 5a75bf7 commit 3606e0e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ router.get("/wind-history/:stationId", async (ctx) => {
});

router.delete("/reset-wind-history", authMiddleware, async (ctx) => {
const entries = await kv.list<TableDataItem>({
const entries = kv.list<TableDataItem>({
prefix: ["windHistoryData"],
});
const stations = await kv.list<StationStats>({
const stations = kv.list<StationStats>({
prefix: ["station"],
});
const transaction = kv.atomic();
Expand All @@ -295,6 +295,7 @@ router.delete("/reset-wind-history", authMiddleware, async (ctx) => {
ctx.response.body = { msg: "Deleted all wind history data" };
ctx.response.status = 200;
} else {
console.error("Failed to delete wind history data", result);
ctx.response.body = {
msg: "Failed to delete wind history data",
result,
Expand Down

0 comments on commit 3606e0e

Please sign in to comment.