show usage in subsription

This commit is contained in:
Bill Yang 2025-03-13 23:26:56 -07:00
parent 3c046f1ec5
commit 69d06c6607
11 changed files with 122 additions and 45 deletions

View file

@ -4,7 +4,7 @@ import dotenv from "dotenv";
import pg from "pg";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "../db/postgres/postgres.js";
import { IS_CLOUD, STRIPE_PLANS } from "./const.js";
import { IS_CLOUD, STRIPE_PRICES } from "./const.js";
import * as schema from "../db/postgres/schema.js";
import { eq } from "drizzle-orm";
import { stripe } from "@better-auth/stripe";
@ -31,7 +31,7 @@ const pluginList = IS_CLOUD
createCustomerOnSignUp: true,
subscription: {
enabled: true,
plans: STRIPE_PLANS,
plans: STRIPE_PRICES,
},
}),
]
@ -120,6 +120,13 @@ export function initAuth(allowedOrigins: string[]) {
enabled: true,
},
user: {
additionalFields: {
monthlyEventCount: {
type: "number",
defaultValue: 0,
required: false,
},
},
deleteUser: {
enabled: true,
// Add a hook to run before deleting a user