Files
route-commerce/db/schema/brand.ts
T
openclaw c86e97e816
Deploy to route.crispygoat.com / deploy (push) Failing after 7s
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:21:57 -06:00

77 lines
2.3 KiB
TypeScript

/**
* Brand settings + brand features. Source: `db/migrations/0001_init.sql`.
*/
import {
pgTable,
uuid,
text,
jsonb,
boolean,
timestamp,
uniqueIndex,
} from "drizzle-orm/pg-core";
import { brands } from "./brands";
export const brandSettings = pgTable(
"brand_settings",
{
brandId: uuid("brand_id")
.primaryKey()
.references(() => brands.id, { onDelete: "cascade" }),
legalBusinessName: text("legal_business_name"),
phone: text("phone"),
email: text("email"),
websiteUrl: text("website_url"),
streetAddress: text("street_address"),
city: text("city"),
state: text("state"),
postalCode: text("postal_code"),
country: text("country").default("US"),
logoUrl: text("logo_url"),
logoUrlDark: text("logo_url_dark"),
heroImageUrl: text("hero_image_url"),
tagline: text("tagline"),
aboutHtml: text("about_html"),
primaryColor: text("primary_color").default("#0F766E"),
defaultEmailSignature: text("default_email_signature"),
invoiceFooterNotes: text("invoice_footer_notes"),
fromEmail: text("from_email"),
fromName: text("from_name"),
replyToEmail: text("reply_to_email"),
customFooterText: text("custom_footer_text"),
featureFlags: jsonb("feature_flags").notNull().default({}),
createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
updatedAt: timestamp("updated_at", { withTimezone: true })
.notNull()
.defaultNow(),
},
);
export const brandFeatures = pgTable(
"brand_features",
{
id: uuid("id").primaryKey().defaultRandom(),
brandId: uuid("brand_id")
.notNull()
.references(() => brands.id, { onDelete: "cascade" }),
featureKey: text("feature_key").notNull(),
enabled: boolean("enabled").notNull().default(false),
enabledAt: timestamp("enabled_at", { withTimezone: true }),
disabledAt: timestamp("disabled_at", { withTimezone: true }),
createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
},
(t) => ({
brandFeatureIdx: uniqueIndex("brand_features_brand_key_idx").on(
t.brandId,
t.featureKey,
),
}),
);
export type BrandSettings = typeof brandSettings.$inferSelect;
export type BrandFeature = typeof brandFeatures.$inferSelect;