Files
route-commerce/supabase/migrations/.archived/099_contact_imports_bucket.sql
T
openclaw 916ad39176
Deploy to route.crispygoat.com / deploy (push) Failing after 3m1s
feat(storage): MinIO object storage, Neon Auth, Supabase removal
- 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
2026-06-09 12:23:37 -06:00

36 lines
893 B
PL/PgSQL

-- Create imports bucket if it doesn't exist
-- Note: Run this in Supabase dashboard or via CLI
-- supabase storage create contacts-imports --public
-- Create RPC function to process imports from bucket URL
CREATE OR REPLACE FUNCTION process_contact_import_from_url(
p_brand_id UUID,
p_file_url TEXT,
p_allow_opt_in_override BOOLEAN DEFAULT false
)
RETURNS JSONB
LANGUAGE plpgsql
SECURITY DEFINER
AS $$
DECLARE
v_result JSONB;
v_csv_text TEXT;
BEGIN
-- Fetch the CSV from the bucket URL
SELECT content INTO v_csv_text
FROM net.http_get(p_file_url);
-- Process the contacts (this would need to be implemented based on your CSV parsing logic)
-- For now, return a placeholder result
-- You would call your existing import logic here
v_result := jsonb_build_object(
'created', 0,
'updated', 0,
'skipped', 0,
'errors', 0
);
RETURN v_result;
END;
$$;