import { churchSchema } from '@crosscode/contracts'; import { defineRoute } from '../route'; import { single } from '../paging'; import { churchProfile } from '../../accounts/church'; /** * The church profile for the public pages (3.7.0, docs/WEBSITE-1.0-PLAN.md ยง9): its brand style * (fonts, corners) and the shared footer's details, from the church's Accounts * (src/accounts/church.ts). null when Accounts isn't connected. */ export const getChurch = defineRoute({ method: 'get', path: '/church', tag: 'Site', summary: "The church's profile", description: "The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.", access: 'public', response: single(churchSchema.nullable()), async handler({ res }) { res.setHeader('Cache-Control', 'public, max-age=60'); return { data: await churchProfile() }; }, });