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:
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import { getAdminUser } from "@/lib/admin-permissions";
|
||||
import { withTenant } from "@/db/client";
|
||||
import { withBrand } from "@/db/client";
|
||||
import { brandSettings } from "@/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
@@ -47,15 +47,15 @@ function readFlag(
|
||||
|
||||
export async function getCommunicationSettings(brandId: string): Promise<CommunicationSettings | null> {
|
||||
try {
|
||||
const rows = await withTenant(brandId, (db) =>
|
||||
const rows = await withBrand(brandId, (db) =>
|
||||
db
|
||||
.select({
|
||||
tenantId: brandSettings.tenantId,
|
||||
brandId: brandSettings.brandId,
|
||||
featureFlags: brandSettings.featureFlags,
|
||||
updatedAt: brandSettings.updatedAt,
|
||||
})
|
||||
.from(brandSettings)
|
||||
.where(eq(brandSettings.tenantId, brandId))
|
||||
.where(eq(brandSettings.brandId, brandId))
|
||||
.limit(1),
|
||||
);
|
||||
|
||||
@@ -65,8 +65,8 @@ export async function getCommunicationSettings(brandId: string): Promise<Communi
|
||||
const flags = (row.featureFlags ?? {}) as Record<string, unknown>;
|
||||
|
||||
return {
|
||||
id: row.tenantId,
|
||||
brand_id: row.tenantId,
|
||||
id: row.brandId,
|
||||
brand_id: row.brandId,
|
||||
default_sender_email: readFlag(flags, "comm_default_sender_email"),
|
||||
default_sender_name: readFlag(flags, "comm_default_sender_name"),
|
||||
reply_to_email: readFlag(flags, "comm_reply_to_email"),
|
||||
@@ -96,11 +96,11 @@ export async function upsertCommunicationSettings(params: {
|
||||
}
|
||||
|
||||
try {
|
||||
const updated = await withTenant(params.brand_id, async (db) => {
|
||||
const updated = await withBrand(params.brand_id, async (db) => {
|
||||
const existing = await db
|
||||
.select({ flags: brandSettings.featureFlags })
|
||||
.from(brandSettings)
|
||||
.where(eq(brandSettings.tenantId, params.brand_id))
|
||||
.where(eq(brandSettings.brandId, params.brand_id))
|
||||
.limit(1);
|
||||
const baseFlags = (existing[0]?.flags ?? {}) as Record<string, unknown>;
|
||||
const nextFlags: Record<string, unknown> = {
|
||||
@@ -115,9 +115,9 @@ export async function upsertCommunicationSettings(params: {
|
||||
const result = await db
|
||||
.update(brandSettings)
|
||||
.set({ featureFlags: nextFlags, updatedAt: new Date() })
|
||||
.where(eq(brandSettings.tenantId, params.brand_id))
|
||||
.where(eq(brandSettings.brandId, params.brand_id))
|
||||
.returning({
|
||||
tenantId: brandSettings.tenantId,
|
||||
brandId: brandSettings.brandId,
|
||||
updatedAt: brandSettings.updatedAt,
|
||||
});
|
||||
return result[0] ?? null;
|
||||
@@ -128,8 +128,8 @@ export async function upsertCommunicationSettings(params: {
|
||||
}
|
||||
|
||||
const settings: CommunicationSettings = {
|
||||
id: updated.tenantId,
|
||||
brand_id: updated.tenantId,
|
||||
id: updated.brandId,
|
||||
brand_id: updated.brandId,
|
||||
default_sender_email: params.sender_email ?? null,
|
||||
default_sender_name: params.sender_name ?? null,
|
||||
reply_to_email: params.reply_to_email ?? null,
|
||||
|
||||
Reference in New Issue
Block a user