config for trial plan

This commit is contained in:
Michael Dausmann
2023-03-19 13:32:56 +11:00
parent 24f3f9d80a
commit 4959475dcc
2 changed files with 3 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import { ACCOUNT_ACCESS, PrismaClient, User, Membership, Account } from '@prisma/client';
import { UtilService } from './util.service';
const config = useRuntimeConfig();
const TRIAL_PLAN_NAME = '3 Month Trial'; // TODO - some sort of config.. this will change for every use of the boilerplate
export type MembershipWithAccount = (Membership & {account: Account});
export type FullDBUser = (User & { memberships: MembershipWithAccount[]; });
@@ -69,7 +69,7 @@ export default class UserAccountService {
}
async createUser( supabase_uid: string, display_name: string ): Promise<FullDBUser | null> {
const trialPlan = await this.prisma.plan.findFirstOrThrow({ where: { name: TRIAL_PLAN_NAME}});
const trialPlan = await this.prisma.plan.findFirstOrThrow({ where: { name: config.trialPlanName}});
return this.prisma.user.create({
data:{
supabase_uid: supabase_uid,