feat: support removing watch status when null

A user can choose to remove a show from being in their media list completely, by setting the watch status to null
This commit is contained in:
2024-07-04 18:18:57 -04:00
parent ad84175d6b
commit 2becf1aa3b
8 changed files with 222 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ const app = new OpenAPIHono<Env>();
const UpdateWatchStatusRequest = z.object({
deviceId: z.string(),
watchStatus: WatchStatus,
watchStatus: WatchStatus.nullable(),
titleId: AniListIdSchema,
isRetrying: z.boolean().optional().default(false),
});
@@ -60,8 +60,12 @@ const route = createRoute({
});
app.openapi(route, async (c) => {
const { deviceId, watchStatus, titleId, isRetrying } =
await c.req.json<typeof UpdateWatchStatusRequest._type>();
const {
deviceId,
watchStatus,
titleId,
isRetrying = false,
} = await c.req.json<typeof UpdateWatchStatusRequest._type>();
const aniListToken = c.req.header("X-AniList-Token");
if (!isRetrying) {