feat(storage): MinIO object storage, Neon Auth, Supabase removal
Deploy to route.crispygoat.com / deploy (push) Failing after 3m1s
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
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
import { getAdminUser } from "@/lib/admin-permissions";
|
||||
import { pool } from "@/lib/db";
|
||||
|
||||
// Stripe API version type - using const assertion for type safety
|
||||
type StripeApiVersion = "2026-05-27.dahlia";
|
||||
|
||||
// ── Price ID config ────────────────────────────────────────────────────────────
|
||||
// Maps plan/addon keys to Stripe price IDs via environment variables
|
||||
|
||||
@@ -45,7 +48,7 @@ export async function createStripeCheckoutSession(
|
||||
|
||||
// Get brand's Stripe customer ID
|
||||
const custRes = await pool.query<{ stripe_customer_id: string | null; name: string }>(
|
||||
"SELECT stripe_customer_id, name FROM tenants WHERE id = $1 LIMIT 1",
|
||||
"SELECT stripe_customer_id, name FROM brands WHERE id = $1 LIMIT 1",
|
||||
[brandId]
|
||||
);
|
||||
const brand = custRes.rows[0];
|
||||
@@ -54,7 +57,7 @@ export async function createStripeCheckoutSession(
|
||||
}
|
||||
|
||||
const Stripe = (await import("stripe")).default;
|
||||
const stripe = new Stripe(stripeKey, { apiVersion: "2026-04-22.dahlia" as any });
|
||||
const stripe = new Stripe(stripeKey, { apiVersion: "2026-05-27.dahlia" as StripeApiVersion });
|
||||
|
||||
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL ?? "http://localhost:3000";
|
||||
|
||||
@@ -121,7 +124,7 @@ export async function cancelAddonSubscription(
|
||||
|
||||
// Get active subscription for this brand
|
||||
const subRes = await pool.query<{ stripe_subscription_id: string | null }>(
|
||||
"SELECT stripe_subscription_id FROM subscriptions WHERE tenant_id = $1 LIMIT 1",
|
||||
"SELECT stripe_subscription_id FROM subscriptions WHERE brand_id = $1 LIMIT 1",
|
||||
[brandId]
|
||||
);
|
||||
if (subRes.rows.length === 0) {
|
||||
@@ -133,7 +136,7 @@ export async function cancelAddonSubscription(
|
||||
}
|
||||
|
||||
const Stripe = (await import("stripe")).default;
|
||||
const stripe = new Stripe(stripeKey, { apiVersion: "2026-04-22.dahlia" as any });
|
||||
const stripe = new Stripe(stripeKey, { apiVersion: "2026-05-27.dahlia" as StripeApiVersion });
|
||||
|
||||
// Retrieve subscription and find the item for this add-on
|
||||
const subscription = await stripe.subscriptions.retrieve(subData.stripe_subscription_id);
|
||||
|
||||
Reference in New Issue
Block a user