From b03cb757f4bb3a0b4ed108df02c63639475e7de9 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 19 Dec 2025 17:28:06 +0100 Subject: [PATCH] Fix watch ws api --- api/shell.nix | 1 + api/src/websockets.ts | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/api/shell.nix b/api/shell.nix index 36ee641a..5b0e12ee 100644 --- a/api/shell.nix +++ b/api/shell.nix @@ -3,6 +3,7 @@ pkgs.mkShell { packages = with pkgs; [ bun biome + websocat # for psql to debug from the cli postgresql_18 # to build libvips (for sharp) diff --git a/api/src/websockets.ts b/api/src/websockets.ts index d244b7fb..dbc76a0c 100644 --- a/api/src/websockets.ts +++ b/api/src/websockets.ts @@ -3,7 +3,6 @@ import Elysia, { type TSchema, t } from "elysia"; import { auth } from "./auth"; import { updateProgress } from "./controllers/profiles/history"; import { getOrCreateProfile } from "./controllers/profiles/profile"; -import { SeedHistory } from "./models/history"; const actionMap = { ping: handler({ @@ -12,7 +11,18 @@ const actionMap = { }, }), watch: handler({ - body: t.Omit(SeedHistory, ["playedDate"]), + body: t.Object({ + percent: t.Integer({ minimum: 0, maximum: 100 }), + time: t.Integer({ + minimum: 0, + }), + videoId: t.Nullable( + t.String({ + format: "uuid", + }), + ), + entry: t.String(), + }), permissions: ["core.read"], async message(ws, body) { const profilePk = await getOrCreateProfile(ws.data.jwt.sub);