Expose dynamic audio on the v2 schedule API

This commit is contained in:
NeilClack
2026-09-11 18:41:57 -05:00
parent 96a1342c10
commit ec826093eb
3 changed files with 17 additions and 1 deletions
+6
View File
@@ -509,6 +509,7 @@ components:
endMinutes, endMinutes,
overnight, overnight,
durationMinutes, durationMinutes,
dynamicAudio,
proclamationIds proclamationIds
] ]
properties: properties:
@@ -540,6 +541,11 @@ components:
type: integer type: integer
minimum: 1 minimum: 1
description: Block length in minutes. An overnight block counts the wrap past midnight as the next day. 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: proclamationIds:
type: array type: array
description: IDs of the selected Proclamations, in play order. description: IDs of the selected Proclamations, in play order.
+8 -1
View File
@@ -149,6 +149,7 @@ export type V2ScheduleBlock = {
endMinutes: number; endMinutes: number;
overnight: boolean; overnight: boolean;
durationMinutes: number; durationMinutes: number;
dynamicAudio: boolean;
proclamationIds: string[]; proclamationIds: string[];
}; };
@@ -162,7 +163,12 @@ export type V2Schedule = {
* marks a range that crosses midnight (end clock time before start), and * marks a range that crosses midnight (end clock time before start), and
* `durationMinutes` counts the wrap as the next day. */ * `durationMinutes` counts the wrap as the next day. */
export function serializeScheduleBlock( export function serializeScheduleBlock(
block: { id: string; startMinutes: number; endMinutes: number }, block: {
id: string;
startMinutes: number;
endMinutes: number;
dynamicAudio?: boolean;
},
proclamationIds: string[] proclamationIds: string[]
): V2ScheduleBlock { ): V2ScheduleBlock {
return { return {
@@ -173,6 +179,7 @@ export function serializeScheduleBlock(
endMinutes: block.endMinutes, endMinutes: block.endMinutes,
overnight: isOvernight(block), overnight: isOvernight(block),
durationMinutes: blockDuration(block), durationMinutes: blockDuration(block),
dynamicAudio: block.dynamicAudio === true,
proclamationIds proclamationIds
}; };
} }
@@ -99,6 +99,7 @@ describe('GET /api/v2/schedule success', () => {
id: 'block-1', id: 'block-1',
startMinutes: 21 * 60, startMinutes: 21 * 60,
endMinutes: 9 * 60, endMinutes: 9 * 60,
dynamicAudio: true,
proclamations: [{ proclamation: { id: 'p1' } }, { proclamation: { id: 'p2' } }] proclamations: [{ proclamation: { id: 'p1' } }, { proclamation: { id: 'p2' } }]
} }
]); ]);
@@ -117,6 +118,7 @@ describe('GET /api/v2/schedule success', () => {
endMinutes: 540, endMinutes: 540,
overnight: true, overnight: true,
durationMinutes: 720, durationMinutes: 720,
dynamicAudio: true,
proclamationIds: ['p1', 'p2'] proclamationIds: ['p1', 'p2']
} }
] ]
@@ -148,6 +150,7 @@ describe('GET /api/v2/schedule success', () => {
endMinutes: 60, endMinutes: 60,
overnight: false, overnight: false,
durationMinutes: 60, durationMinutes: 60,
dynamicAudio: false,
proclamationIds: ['p1'] proclamationIds: ['p1']
}); });
}); });