Fix watch ws api

This commit is contained in:
Zoe Roux 2025-12-19 17:28:06 +01:00
parent ac6478fee3
commit b03cb757f4
No known key found for this signature in database
2 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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);