Preparing for actual live moves

This commit is contained in:
2026-02-07 23:25:37 +01:00
parent 1f969b8ff1
commit 6744a67931
4 changed files with 45 additions and 67 deletions
+29
View File
@@ -1,3 +1,32 @@
"use server";
import "server-only";
import { LiveRun, LiveRunMove } from "./types";
const liveRuns: LiveRun[] = [];
const liveRunMoves: Record<string, LiveRunMove[]> = {};
export async function getLiveRuns(): Promise<LiveRun[]> {
return liveRuns;
}
export async function getLiveRun(id: string): Promise<LiveRun | undefined> {
return liveRuns.find((r) => r.id === id);
}
export async function getLiveRunMoves(
id: string,
): Promise<LiveRunMove[] | undefined> {
return liveRunMoves[id];
}
export async function addRun(run: LiveRun) {
if (!liveRuns.find((r) => r.id === run.id || r.username === run.username))
throw "Duplicate run";
liveRuns.push(run);
}
export async function addLiveRunMove(id: string) {
if (!liveRuns.find((r) => r.id === id)) throw "Invalid run";
}