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.
9 lines
390 B
TypeScript
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);
|
|
});
|