← back to Nineoh Guide
api/shows: add showInfo field (description, seasonCount, episodeCount, premiereDate, finaleDate, disclaimerText)
f7cb8f0364f4c9bb8b2768c5738542f0e186e58b · 2026-08-06 04:17:14 -0700 · steve@designerwallcoverings.com
Files touched
M apps/web/app/api/shows/route.ts
Diff
commit f7cb8f0364f4c9bb8b2768c5738542f0e186e58b
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date: Thu Aug 6 04:17:14 2026 -0700
api/shows: add showInfo field (description, seasonCount, episodeCount, premiereDate, finaleDate, disclaimerText)
---
apps/web/app/api/shows/route.ts | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/apps/web/app/api/shows/route.ts b/apps/web/app/api/shows/route.ts
index f7929d7..115a9fe 100644
--- a/apps/web/app/api/shows/route.ts
+++ b/apps/web/app/api/shows/route.ts
@@ -7,19 +7,45 @@ export const dynamic = "force-dynamic";
* Show list for the show selector (web + Expo). Multi-show support: the guide
* covers the ORIGINAL "Beverly Hills, 90210" (1990) and the 2008 reboot "90210".
* The ORIGINAL is returned FIRST so the client defaults to it.
+ *
+ * Each show now includes a `showInfo` object with:
+ * - description: the full original description text
+ * - seasonCount, episodeCount: computed from the seasons/episodes tables
+ * - premiereDate, finaleDate: ISO date strings (or null)
+ * - disclaimerText: the show's disclaimer from the DB
*/
export async function GET() {
try {
const { rows } = await pool.query(
- `select id, canonical_title, display_title
- from shows
- order by (canonical_title = 'beverly-hills-90210') desc,
- created_at asc`
+ `select s.id,
+ s.canonical_title,
+ s.display_title,
+ s.description_original,
+ s.disclaimer_text,
+ count(distinct se.id)::int as season_count,
+ count(distinct ep.id)::int as episode_count,
+ to_char(min(ep.air_date), 'YYYY-MM-DD') as premiere_date,
+ to_char(max(ep.air_date), 'YYYY-MM-DD') as finale_date
+ from shows s
+ left join seasons se on se.show_id = s.id
+ left join episodes ep on ep.show_id = s.id
+ group by s.id, s.canonical_title, s.display_title,
+ s.description_original, s.disclaimer_text
+ order by (s.canonical_title = 'beverly-hills-90210') desc,
+ s.created_at asc`
);
const shows = rows.map((r) => ({
id: r.id as string,
canonicalTitle: r.canonical_title as string,
displayTitle: r.display_title as string,
+ showInfo: {
+ description: r.description_original as string,
+ seasonCount: r.season_count as number,
+ episodeCount: r.episode_count as number,
+ premiereDate: r.premiere_date as string | null,
+ finaleDate: r.finale_date as string | null,
+ disclaimerText: r.disclaimer_text as string,
+ },
}));
return NextResponse.json({ shows });
} catch (err) {
← 620829a auto-save: 2026-08-05T18:14:36 (1 files) — db/neon-backup-20
·
back to Nineoh Guide
·
App.tsx: add ShowInfo type + show info banner (chips, expand 5b12116 →