Refactor code saving data

Move the code dealing with saving and loading data to server/database to
gather it all up into one place.
This commit is contained in:
Hornwitser 2025-03-05 18:41:47 +01:00
parent 754d175ce2
commit 6ea3567c94
8 changed files with 64 additions and 58 deletions

View file

@ -1,6 +1,5 @@
import { readFile } from "node:fs/promises";
import { Schedule } from "~/shared/types/schedule";
import { readSchedule } from "~/server/database";
export default defineEventHandler(async (event) => {
return JSON.parse(await readFile("schedule.json", "utf-8")) as Schedule;
return await readSchedule();
})