Files
weatherapi/internal/adapters/outbound/postgres/weatherstories_queries.go
Eric Rakestraw ecea856e8e
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
Implemented weather stories support
2026-05-30 07:06:29 -05:00

49 lines
850 B
Go

// weatherstories_queries.go contains SQL text for weather story reads.
// Layer: adapters/outbound/postgres weather stories feature.
package postgres
const (
queryLatestWeatherStoryRun = `
SELECT
event_id,
office_id,
as_of
FROM weather_story_runs
ORDER BY as_of DESC, event_emitted_at DESC
LIMIT 1`
queryWeatherStoriesForRun = `
SELECT
story_index,
office_id,
start_time,
end_time,
updated_at,
title,
description,
alt_text,
priority,
story_order,
download_url
FROM weather_stories
WHERE run_event_id = $1
ORDER BY story_index ASC`
queryLatestWeatherStory = `
SELECT
story_index,
office_id,
start_time,
end_time,
updated_at,
title,
description,
alt_text,
priority,
story_order,
download_url
FROM weather_stories
ORDER BY updated_at DESC, as_of DESC, story_order ASC, story_index ASC
LIMIT 1`
)