owltide/server/api/schedule.ts
Hornwitser 3be7f8be05 Refactor user storage and update
Rename accounts to users to be consistent with the new naming scheme
where account only referes to the logged in user of the session and
implement live updates of users via a user store which listens for
updates from the event stream.
2025-06-23 00:28:58 +02:00

9 lines
390 B
TypeScript

import { readUsers, readSchedule } from "~/server/database";
import type { ApiAccount } from "~/shared/types/api";
import { canSeeCrew } from "../utils/schedule";
export default defineEventHandler(async (event) => {
const session = await getServerSession(event);
const schedule = await readSchedule();
return canSeeCrew(session?.account.type) ? schedule : filterSchedule(schedule);
});