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
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
/**
|
|
* Billing: plans, add_ons, brand_add_ons.
|
|
* Source: `db/migrations/0001_init.sql`.
|
|
*/
|
|
import {
|
|
pgTable,
|
|
uuid,
|
|
text,
|
|
integer,
|
|
timestamp,
|
|
jsonb,
|
|
primaryKey,
|
|
} from "drizzle-orm/pg-core";
|
|
import { brands } from "./brands";
|
|
|
|
export const plans = pgTable("plans", {
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
code: text("code", {
|
|
enum: ["starter", "farm", "enterprise"],
|
|
}).notNull().unique(),
|
|
name: text("name").notNull(),
|
|
monthlyPriceCents: integer("monthly_price_cents").notNull(),
|
|
maxUsers: integer("max_users").notNull(),
|
|
maxProducts: integer("max_products").notNull(),
|
|
maxStopsMonthly: integer("max_stops_monthly").notNull(),
|
|
features: jsonb("features").notNull().default([]),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
});
|
|
|
|
export const addOns = pgTable("add_ons", {
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
code: text("code", {
|
|
enum: [
|
|
"wholesale_portal", "harvest_reach", "ai_tools",
|
|
"water_log", "square_sync", "sms_campaigns",
|
|
],
|
|
}).notNull().unique(),
|
|
name: text("name").notNull(),
|
|
monthlyPriceCents: integer("monthly_price_cents").notNull(),
|
|
description: text("description"),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
});
|
|
|
|
export const brandAddOns = pgTable(
|
|
"brand_add_ons",
|
|
{
|
|
brandId: uuid("brand_id")
|
|
.notNull()
|
|
.references(() => brands.id, { onDelete: "cascade" }),
|
|
addOnId: uuid("add_on_id")
|
|
.notNull()
|
|
.references(() => addOns.id, { onDelete: "cascade" }),
|
|
stripeSubscriptionId: text("stripe_subscription_id"),
|
|
status: text("status", { enum: ["active", "canceled"] })
|
|
.notNull()
|
|
.default("active"),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
},
|
|
(t) => ({
|
|
pk: primaryKey({ columns: [t.brandId, t.addOnId] }),
|
|
}),
|
|
);
|
|
|
|
export type Plan = typeof plans.$inferSelect;
|
|
export type AddOn = typeof addOns.$inferSelect;
|
|
export type BrandAddOn = typeof brandAddOns.$inferSelect;
|