Rename AcountSession to ServerSession
All checks were successful
/ build (push) Successful in 1m12s
/ deploy (push) Successful in 16s

Start the work of clearly distingushing client side types, server side
types and types shared over the API by renaming "AccountSession" and
"Session" names used on the server to "ServerSession".
This commit is contained in:
Hornwitser 2025-06-09 16:51:05 +02:00
parent 16191a8dd2
commit 251e83f640
15 changed files with 39 additions and 36 deletions

View file

@ -5,11 +5,11 @@ import {
import { cancelAccountStreams } from "~/server/streams";
export default defineEventHandler(async (event) => {
const accountSession = await requireAccountSession(event);
const serverSession = await requireServerSession(event);
let accounts = await readAccounts();
const sessionAccount = accounts.find(
account => account.id === accountSession.accountId
account => account.id === serverSession.accountId
);
if (!sessionAccount) {
throw Error("Account does not exist");
@ -19,13 +19,13 @@ export default defineEventHandler(async (event) => {
const removedSessionIds = new Set<number>();
let sessions = await readSessions();
sessions = sessions.filter(session => {
if (session.accountId === accountSession.accountId) {
if (session.accountId === serverSession.accountId) {
removedSessionIds.add(session.id);
return false;
}
return true;
});
cancelAccountStreams(accountSession.accountId);
cancelAccountStreams(serverSession.accountId);
await writeSessions(sessions);
await deleteCookie(event, "session");
@ -37,7 +37,7 @@ export default defineEventHandler(async (event) => {
await writeSubscriptions(subscriptions);
// Remove the account
accounts = accounts.filter(account => account.id !== accountSession.accountId);
accounts = accounts.filter(account => account.id !== serverSession.accountId);
await writeAccounts(accounts);
// Update Schedule counts.