Add isAvailable filter for both entries & shows

This commit is contained in:
Zoe Roux
2025-06-05 00:21:40 +02:00
parent 107e581801
commit be4b4f016b
5 changed files with 19 additions and 4 deletions
+1
View File
@@ -72,6 +72,7 @@ export const entryFilters: FilterDef = {
runtime: { column: entries.runtime, type: "float" },
airDate: { column: entries.airDate, type: "date" },
playedDate: { column: entryProgressQ.playedDate, type: "date" },
isAvailable: { column: isNotNull(entries.availableSince), type: "bool" },
};
const extraFilters: FilterDef = {
+3 -2
View File
@@ -1,4 +1,4 @@
import { type SQL, and, eq, exists, ne, sql } from "drizzle-orm";
import { type SQL, and, eq, exists, gt, ne, sql } from "drizzle-orm";
import { db } from "~/db";
import {
entries,
@@ -60,7 +60,7 @@ export const showFilters: FilterDef = {
runtime: { column: shows.runtime, type: "float" },
airDate: { column: shows.startAir, type: "date" },
startAir: { column: shows.startAir, type: "date" },
endAir: { column: shows.startAir, type: "date" },
endAir: { column: shows.endAir, type: "date" },
originalLanguage: {
column: sql`${shows.original}->'language'`,
type: "string",
@@ -76,6 +76,7 @@ export const showFilters: FilterDef = {
values: WatchlistStatus.enum,
},
score: { column: watchStatusQ.score, type: "int" },
isAvailable: { column: sql`(${shows.availableCount} > 0)`, type: "bool" },
};
export const showSort = Sort(
{