Revert "Revert "feat: 🎸 revenue cat""

This reverts commit 029c50dcf0.
This commit is contained in:
John Yeo
2025-12-22 21:19:13 +00:00
parent cb4403a4fe
commit 2cbaa8a340
69 changed files with 4425 additions and 61 deletions

View File

@@ -1,2 +1,3 @@
// Vercel
// Vercel + RevenueCat
export * from "./revenuecatModels/revenuecatMappingsTable.js";
export * from "./vercelModels/vercelResourcesTable.js";

View File

@@ -0,0 +1,30 @@
import type { AppEnv } from "@models/genModels/genEnums";
import { organizations } from "@models/orgModels/orgTable.js";
import { foreignKey, pgTable, primaryKey, text } from "drizzle-orm/pg-core";
// biome-ignore lint/suspicious/noExplicitAny: Drizzle table typing workaround for Bun TS2742 error
export const revenuecatMappings: any = pgTable(
"revenuecat_mappings",
{
org_id: text("org_id").notNull(),
env: text("env").$type<AppEnv>().notNull(),
autumn_product_id: text("autumn_product_id").notNull(),
revenuecat_product_ids: text("revenuecat_product_ids")
.array()
.notNull()
.default([]),
},
(table) => [
primaryKey({
columns: [table.org_id, table.env, table.autumn_product_id],
name: "revenuecat_mappings_pkey",
}),
foreignKey({
columns: [table.org_id],
foreignColumns: [organizations.id],
name: "revenuecat_mappings_org_id_fkey",
}).onDelete("cascade"),
],
);
export type RevenuecatMapping = typeof revenuecatMappings.$inferSelect;