From ec826093eb02c82c24d41921584e3973a355d379 Mon Sep 17 00:00:00 2001 From: NeilClack Date: Fri, 11 Sep 2026 18:41:57 -0500 Subject: [PATCH] Expose dynamic audio on the v2 schedule API --- docs/openapi.yaml | 6 ++++++ src/lib/server/v2-serializers.ts | 9 ++++++++- src/routes/api/v2/schedule/schedule.spec.ts | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index bfed06a..c71c4be 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -509,6 +509,7 @@ components: endMinutes, overnight, durationMinutes, + dynamicAudio, proclamationIds ] properties: @@ -540,6 +541,11 @@ components: type: integer minimum: 1 description: Block length in minutes. An overnight block counts the wrap past midnight as the next day. + dynamicAudio: + type: boolean + description: | + When true, dynamic audio is enabled for the block's duration, overriding any + audio selections made on the device while the block is active. proclamationIds: type: array description: IDs of the selected Proclamations, in play order. diff --git a/src/lib/server/v2-serializers.ts b/src/lib/server/v2-serializers.ts index 7aa6a74..5700851 100644 --- a/src/lib/server/v2-serializers.ts +++ b/src/lib/server/v2-serializers.ts @@ -149,6 +149,7 @@ export type V2ScheduleBlock = { endMinutes: number; overnight: boolean; durationMinutes: number; + dynamicAudio: boolean; proclamationIds: string[]; }; @@ -162,7 +163,12 @@ export type V2Schedule = { * marks a range that crosses midnight (end clock time before start), and * `durationMinutes` counts the wrap as the next day. */ export function serializeScheduleBlock( - block: { id: string; startMinutes: number; endMinutes: number }, + block: { + id: string; + startMinutes: number; + endMinutes: number; + dynamicAudio?: boolean; + }, proclamationIds: string[] ): V2ScheduleBlock { return { @@ -173,6 +179,7 @@ export function serializeScheduleBlock( endMinutes: block.endMinutes, overnight: isOvernight(block), durationMinutes: blockDuration(block), + dynamicAudio: block.dynamicAudio === true, proclamationIds }; } diff --git a/src/routes/api/v2/schedule/schedule.spec.ts b/src/routes/api/v2/schedule/schedule.spec.ts index de18046..cf26dee 100644 --- a/src/routes/api/v2/schedule/schedule.spec.ts +++ b/src/routes/api/v2/schedule/schedule.spec.ts @@ -99,6 +99,7 @@ describe('GET /api/v2/schedule success', () => { id: 'block-1', startMinutes: 21 * 60, endMinutes: 9 * 60, + dynamicAudio: true, proclamations: [{ proclamation: { id: 'p1' } }, { proclamation: { id: 'p2' } }] } ]); @@ -117,6 +118,7 @@ describe('GET /api/v2/schedule success', () => { endMinutes: 540, overnight: true, durationMinutes: 720, + dynamicAudio: true, proclamationIds: ['p1', 'p2'] } ] @@ -148,6 +150,7 @@ describe('GET /api/v2/schedule success', () => { endMinutes: 60, overnight: false, durationMinutes: 60, + dynamicAudio: false, proclamationIds: ['p1'] }); });