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

@ -1,8 +1,13 @@
import { readFile, unlink, writeFile } from "node:fs/promises";
import { Schedule } from "~/shared/types/schedule";
import { Account, Subscription, Session } from "~/shared/types/account";
import { Account, Subscription } from "~/shared/types/account";
import { generateDemoSchedule, generateDemoAccounts } from "./generate-demo-schedule";
export interface ServerSession {
id: number,
accountId: number,
};
// For this demo I'm just storing the runtime data in JSON files. When making
// this into proper application this should be replaced with an actual database.
@ -87,9 +92,9 @@ export async function nextSessionId() {
}
export async function readSessions() {
return await readJson<Session[]>(sessionsPath, []);
return await readJson<ServerSession[]>(sessionsPath, []);
}
export async function writeSessions(sessions: Session[]) {
export async function writeSessions(sessions: ServerSession[]) {
await writeFile(sessionsPath, JSON.stringify(sessions, undefined, "\t") + "\n", "utf-8");
}