c86e97e816
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
76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
/**
|
|
* Products. Source: `db/migrations/0001_init.sql`.
|
|
*/
|
|
import {
|
|
pgTable,
|
|
uuid,
|
|
text,
|
|
integer,
|
|
boolean,
|
|
timestamp,
|
|
index,
|
|
} from "drizzle-orm/pg-core";
|
|
import { brands } from "./brands";
|
|
|
|
export const products = pgTable(
|
|
"products",
|
|
{
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
brandId: uuid("brand_id")
|
|
.notNull()
|
|
.references(() => brands.id, { onDelete: "cascade" }),
|
|
name: text("name").notNull(),
|
|
description: text("description"),
|
|
sku: text("sku"),
|
|
type: text("type", { enum: ["standard", "wholesale", "both"] })
|
|
.notNull()
|
|
.default("standard"),
|
|
priceCents: integer("price_cents").notNull(),
|
|
inventory: integer("inventory").notNull().default(0),
|
|
unit: text("unit"),
|
|
active: boolean("active").notNull().default(true),
|
|
isTaxable: boolean("is_taxable").notNull().default(false),
|
|
pickupType: text("pickup_type", { enum: ["pickup", "ship", "all"] })
|
|
.notNull()
|
|
.default("all"),
|
|
imageUrl: text("image_url"),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
},
|
|
(t) => ({
|
|
brandIdx: index("products_brand_idx").on(t.brandId),
|
|
activeIdx: index("products_active_idx").on(t.brandId, t.active),
|
|
}),
|
|
);
|
|
|
|
export type Product = typeof products.$inferSelect;
|
|
export type NewProduct = typeof products.$inferInsert;
|
|
|
|
// ── Product Images ─────────────────────────────────────────────────────────────
|
|
|
|
export const productImages = pgTable(
|
|
"product_images",
|
|
{
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
productId: uuid("product_id")
|
|
.notNull()
|
|
.references(() => products.id, { onDelete: "cascade" }),
|
|
storageKey: text("storage_key").notNull(),
|
|
position: integer("position").notNull().default(0),
|
|
altText: text("alt_text"),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
},
|
|
(t) => ({
|
|
productIdx: index("product_images_product_idx").on(t.productId),
|
|
}),
|
|
);
|
|
|
|
export type ProductImage = typeof productImages.$inferSelect;
|
|
export type NewProductImage = typeof productImages.$inferInsert;
|