Rename AcountSession to ServerSession
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:
parent
16191a8dd2
commit
251e83f640
15 changed files with 39 additions and 36 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue