mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
583 B
PL/PgSQL
14 lines
583 B
PL/PgSQL
CREATE OR REPLACE FUNCTION public.get_maintenance_status()
|
|
RETURNS jsonb
|
|
LANGUAGE sql
|
|
STABLE
|
|
SECURITY DEFINER
|
|
SET search_path = public
|
|
AS $$
|
|
SELECT jsonb_build_object(
|
|
'enabled', COALESCE((SELECT lower(value) = 'true' FROM public.company_settings WHERE key = 'maintenance_mode'), false),
|
|
'message', COALESCE((SELECT value FROM public.company_settings WHERE key = 'maintenance_message'), 'The site is currently undergoing maintenance. Only administrators can sign in at this time.')
|
|
);
|
|
$$;
|
|
|
|
GRANT EXECUTE ON FUNCTION public.get_maintenance_status() TO anon, authenticated; |