fix: sync capture override response

This commit is contained in:
William Valentin
2026-02-04 11:02:06 -08:00
parent 8eae0c7c97
commit ffba6fb290
2 changed files with 33 additions and 4 deletions

View File

@@ -102,6 +102,18 @@ export async function handleSetCaptureOverride(input: {
return { status: 500, body: { error: "insert_failed" } };
}
const assetRows = await db<
{
capture_ts_utc: string | null;
}[]
>`
select capture_ts_utc
from assets
where id = ${created.asset_id}
limit 1
`;
const baseCaptureTs = assetRows[0]?.capture_ts_utc ?? null;
const payload = JSON.stringify({
capture_ts_utc_override: created.capture_ts_utc_override,
capture_offset_minutes_override: created.capture_offset_minutes_override,
@@ -111,5 +123,11 @@ export async function handleSetCaptureOverride(input: {
values ('admin', 'override_capture_ts', 'asset', ${created.asset_id}, ${payload}::jsonb)
`;
return { status: 200, body: created };
return {
status: 200,
body: {
...created,
base_capture_ts_utc: baseCaptureTs,
},
};
}