feat(storage): MinIO object storage, Neon Auth, Supabase removal
Deploy to route.crispygoat.com / deploy (push) Failing after 7s

- 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:
openclaw
2026-06-09 11:32:17 -06:00
parent bb464bda65
commit c86e97e816
348 changed files with 6616 additions and 3096 deletions
+10 -10
View File
@@ -3,13 +3,13 @@
import { and, eq, sql, SQL } from "drizzle-orm";
import { getAdminUser } from "@/lib/admin-permissions";
import { getActiveBrandId } from "@/lib/brand-scope";
import { withTenant, withPlatformAdmin } from "@/db/client";
import { withBrand, withPlatformAdmin } from "@/db/client";
import { campaigns, customers } from "@/db/schema";
import type { AudienceRules } from "./campaigns";
export type AudiencePreviewResult = {
count: number;
sample_customers: { id: string; email: string; name: string }[];
sample_customers: { id: string; email: string; fullName: string | null }[];
};
/**
@@ -36,23 +36,23 @@ export async function previewCampaignAudience(
}
try {
const rows = await withTenant(brandId, (db) =>
const rows = await withBrand(brandId, (db) =>
db
.select({
id: customers.id,
email: customers.email,
name: customers.name,
fullName: customers.fullName,
})
.from(customers)
.where(and(eq(customers.tenantId, brandId), eq(customers.emailOptIn, true)))
.where(and(eq(customers.brandId, brandId), eq(customers.emailOptIn, true)))
.limit(5),
);
const countRows = await withTenant(brandId, (db) =>
const countRows = await withBrand(brandId, (db) =>
db
.select({ value: sql<number>`count(*)::int` })
.from(customers)
.where(and(eq(customers.tenantId, brandId), eq(customers.emailOptIn, true))),
.where(and(eq(customers.brandId, brandId), eq(customers.emailOptIn, true))),
);
return {
@@ -60,7 +60,7 @@ export async function previewCampaignAudience(
sample_customers: rows.map((r) => ({
id: r.id,
email: r.email ?? "",
name: r.name,
fullName: r.fullName,
})),
};
} catch {
@@ -153,11 +153,11 @@ export async function sendCampaign(campaignId: string, brandId?: string): Promis
}
const conds: SQL[] = [eq(campaigns.id, campaignId)];
if (activeBrandId) conds.push(eq(campaigns.tenantId, activeBrandId));
if (activeBrandId) conds.push(eq(campaigns.brandId, activeBrandId));
try {
const updated = activeBrandId
? await withTenant(activeBrandId, (db) =>
? await withBrand(activeBrandId, (db) =>
db
.update(campaigns)
.set({ status: "sent", sentAt: new Date() })