feat(housekeeping): deliver hotel operations
CI / check (pull_request) Failing after 36s
CI / release (pull_request) Skipped
CI / deploy (pull_request) Skipped

This commit is contained in:
Simo committed 2026-08-30 14:34:26 +02:00
1 parent bfc5bd78a1
commit abc707cfb2
43 files changed
+3749 -615

No files matched your search

@@ -0,0 +1,42 @@
import type { HotelQueryData, NormalizedHotelQueryInput } from "./rooms";
export async function loadHotelRadioQuery(
input: NormalizedHotelQueryInput,
): Promise<HotelQueryData> {
if (input.routeId !== "hotel.radio.monitoring") {
const { loadHotelDatabaseQuery } = await import("./hotel-production");
return loadHotelDatabaseQuery(input);
}
const { fetchListeners, fetchNowPlaying } = await import(
"@/lib/services/radio"
);
const [nowPlaying, listeners] = await Promise.all([
fetchNowPlaying(),
fetchListeners(),
]);
const items: Array<HotelQueryData["items"][number]> = [];
if (nowPlaying) {
items.push({
id: "now-playing",
title: nowPlaying.title,
description: nowPlaying.artist ?? undefined,
status: "playing",
href: "/ase/hotel/radio/monitoring",
});
}
if (listeners !== null) {
items.push({
id: "listeners",
title: `${listeners} listeners`,
status: "live",
href: "/ase/hotel/radio/monitoring",
});
}
return {
kind: "radio",
items,
total: items.length,
partialDependencies:
nowPlaying === null && listeners === null ? ["radio"] : [],
};
}