916ad39176
Deploy to route.crispygoat.com / deploy (push) Failing after 3m1s
- Add MinIO/S3-compatible storage client (src/lib/storage.ts) with uploadObject, deleteObject, presigned URL helpers, and BUCKETS constant - Wire product images, brand logos, and water log photos to MinIO via the new storage client - Migrate forgot-password to Neon Auth (remove Supabase /auth/v1/recover call) - Migrate send-scheduled cron to direct Postgres + Resend (remove Supabase Edge Function proxy) - Add logoUrl to email types (OrderReceipt, Welcome, PasswordReset) and pass brand_settings.logo_url from all call sites - Update email templates to use dynamic logoUrl instead of hardcoded Supabase bucket URLs - Remove hardcoded Supabase URLs from TuxedoVideoHero, TuxedoAboutPage, TimeTrackingFieldClient; use brand_settings props + local public/ fallback - Download brand logos (3) and tuxedo-hero.mp4 (36MB) from Supabase bucket to public/ for local development - Add MinIO env vars to .env.example (endpoint, access key, secret, buckets) - Fix TimeTrackingFieldClient to destructure logoUrl and brandAccent props - Fix admin/users.ts logoUrl type (null → undefined for optional string) - Remove stale sb- cookie from wholesale-auth - Migrate tuxedo/about page to remove supabase import and use pool query for wholesale_settings lookup
50 lines
1.3 KiB
PL/PgSQL
50 lines
1.3 KiB
PL/PgSQL
-- Migration: 148_public_stops_rpc.sql
|
|
-- Description: Public RPC to fetch active stops for a brand by slug.
|
|
-- Used by the /tuxedo and /indian-river-direct storefront stop pages
|
|
-- (refactored from client-side supabase.from() to server components).
|
|
--
|
|
-- SECURITY DEFINER bypasses RLS for a clean public read; the function
|
|
-- filters by brand slug + active=true so callers can't enumerate other
|
|
-- brands' stops. Granted to anon for public storefront access.
|
|
|
|
CREATE OR REPLACE FUNCTION get_public_stops_for_brand(p_brand_slug TEXT)
|
|
RETURNS TABLE (
|
|
id UUID,
|
|
city TEXT,
|
|
state TEXT,
|
|
date TIMESTAMPTZ,
|
|
"time" TEXT,
|
|
location TEXT,
|
|
address TEXT,
|
|
slug TEXT,
|
|
cutoff_time TIMESTAMPTZ
|
|
)
|
|
LANGUAGE plpgsql
|
|
SECURITY DEFINER
|
|
SET search_path = public
|
|
AS $$
|
|
BEGIN
|
|
RETURN QUERY
|
|
SELECT
|
|
s.id,
|
|
s.city,
|
|
s.state,
|
|
s.date,
|
|
s."time",
|
|
s.location,
|
|
s.address,
|
|
s.slug,
|
|
s.cutoff_time
|
|
FROM stops s
|
|
INNER JOIN brands b ON s.brand_id = b.id
|
|
WHERE s.active = true
|
|
AND b.slug = p_brand_slug
|
|
ORDER BY s.date ASC;
|
|
END;
|
|
$$;
|
|
|
|
-- Public storefront pages call this via the anon key.
|
|
GRANT EXECUTE ON FUNCTION get_public_stops_for_brand(TEXT) TO anon;
|
|
GRANT EXECUTE ON FUNCTION get_public_stops_for_brand(TEXT) TO authenticated;
|
|
GRANT EXECUTE ON FUNCTION get_public_stops_for_brand(TEXT) TO service_role;
|