Files
aniplay-api/src/controllers/maybeUpdateLastConnectedAt.ts
Rushil Perera 336701a84b feat: schedule next airing episode
happens when new title is saved, or when new episode internal route is run successfully
2024-09-09 03:53:34 -05:00

14 lines
373 B
TypeScript

import { createMiddleware } from "hono/factory";
import { updateDeviceLastConnectedAt } from "~/models/token";
export const maybeUpdateLastConnectedAt = createMiddleware(async (c, next) => {
const deviceId = await c.req.header("X-Aniplay-Device-Id");
if (!deviceId) {
return next();
}
await updateDeviceLastConnectedAt(c.env, deviceId);
return next();
});