config for trial plan
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { ACCOUNT_ACCESS, PrismaClient, User, Membership, Account } from '@prisma/client';
|
import { ACCOUNT_ACCESS, PrismaClient, User, Membership, Account } from '@prisma/client';
|
||||||
import { UtilService } from './util.service';
|
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 MembershipWithAccount = (Membership & {account: Account});
|
||||||
export type FullDBUser = (User & { memberships: MembershipWithAccount[]; });
|
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> {
|
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({
|
return this.prisma.user.create({
|
||||||
data:{
|
data:{
|
||||||
supabase_uid: supabase_uid,
|
supabase_uid: supabase_uid,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default defineNuxtConfig({
|
|||||||
stripeSecretKey: process.env.STRIPE_SECRET_KEY,
|
stripeSecretKey: process.env.STRIPE_SECRET_KEY,
|
||||||
stripeEndpointSecret: process.env.STRIPE_ENDPOINT_SECRET,
|
stripeEndpointSecret: process.env.STRIPE_ENDPOINT_SECRET,
|
||||||
subscriptionGraceDays: 3,
|
subscriptionGraceDays: 3,
|
||||||
|
trialPlanName: '3 Month Trial',
|
||||||
public: {
|
public: {
|
||||||
debugMode: true,
|
debugMode: true,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user