ci / check (push) Successful in 55s
- add /cool, /cool?vote=1, /cool/stage and /cool/city on the existing Nuxt/Onyx stack - wire real route/shade metrics and OSM geometry from the route bundle; city-gap data for the city view - show shade % and direct-sun minutes together; recommend Accessible for Ruth with the 15% ramp trade-off - add in-memory time/scene/round state and one anonymous vote per session, polled every 2 s - keep the retail module linked but out of the Cool City story
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
import { isCoolRound } from '../../../shared/cool'
|
|
import { getCoolVoteTally, resetCoolRound } from '../../utils/cool-votes'
|
|
|
|
interface ResetBody {
|
|
round?: unknown
|
|
}
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
setHeader(event, 'cache-control', 'no-store')
|
|
const body = await readBody<ResetBody>(event)
|
|
const round = body?.round ?? 'preselection'
|
|
if (!isCoolRound(round)) {
|
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
|
}
|
|
const state = resetCoolRound(round)
|
|
return { state, tally: getCoolVoteTally(round) }
|
|
})
|