Remove checkoutSessionId from project (#282)

* remove checkoutSessionId from project

* fix app_diff

* Update schema.prisma.diff

---------

Co-authored-by: vincanger <70215737+vincanger@users.noreply.github.com>
This commit is contained in:
Shemang Joshua
2024-10-14 13:10:22 +01:00
committed by GitHub
parent 515f77800c
commit e641beaff7
5 changed files with 3 additions and 9 deletions

View File

@@ -13,6 +13,6 @@
- paymentProcessorUserId String? @unique
- lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
+ stripeId String? @unique
checkoutSessionId String?
subscriptionStatus String? // 'active', 'canceled', 'past_due', 'deleted'
subscriptionStatus String? // 'active', 'cancel_at_period_end', 'past_due', 'deleted'
subscriptionPlan String? // 'hobby', 'pro'
sendNewsletter Boolean @default(false)

View File

@@ -1,6 +1,6 @@
--- template/app/src/server/scripts/dbSeeds.ts
+++ opensaas-sh/app/src/server/scripts/dbSeeds.ts
@@ -38,10 +38,12 @@
@@ -38,9 +38,11 @@
sendNewsletter: false,
credits,
subscriptionStatus,
@@ -8,7 +8,6 @@
- paymentProcessorUserId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
+ stripeId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
datePaid: hasUserPaidOnStripe ? faker.date.between({ from: createdAt, to: lastActiveTimestamp }) : null,
checkoutSessionId: hasUserPaidOnStripe ? `cs_test_${faker.string.uuid()}` : null,
subscriptionPlan: subscriptionStatus ? faker.helpers.arrayElement(getSubscriptionPaymentPlanIds()) : null,
+ // For the demo app, we want to default isMockUser to true so that our admin dash only shows mock users
+ // and not real users signing up to test the app

View File

@@ -22,7 +22,6 @@ entity User {=psl
isAdmin Boolean @default(false)
paymentProcessorUserId String? @unique
lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
checkoutSessionId String?
subscriptionPlan String?
subscriptionStatus String?
sendEmail Boolean @default(false)
@@ -46,7 +45,6 @@ entity User {=psl
id Int @id @default(autoincrement())
//...
paymentProcessorUserId String? @unique
checkoutSessionId String?
subscriptionPlan String?
subscriptionStatus String?
datePaid DateTime?
@@ -56,7 +54,6 @@ psl=}
```
- `paymentProcessorUserId`: The payment processor customer ID. This is created on checkout and used to identify the customer.
- `checkoutSessionId`: The payment processor checkout session ID. This is created by Stripe on checkout and used to identify the checkout session.
- `subscriptionPlan`: The subscription plan the user is on. This is set by the app and is used to determine what features the user has access to. By default, we have three plans: `hobby` and `pro` subscription plans, as well as a `credits10` one-time purchase plan.
- `subscriptionStatus`: The subscription status of the user. This is set by the payment processor and is used to determine whether the user has access to the app or not. By default, we have four statuses: `active`, `past_due`, `cancel_at_period_end`, and `deleted`.
- `credits` (optional): By default, a user is given 3 credits to trial your product before they have to pay. You can create a one-time purchase product in Stripe to allow users to purchase more credits if they run out, e.g. the `credits10` plan in the template.

View File

@@ -18,7 +18,6 @@ model User {
paymentProcessorUserId String? @unique
lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
checkoutSessionId String?
subscriptionStatus String? // 'active', 'cancel_at_period_end', 'past_due', 'deleted'
subscriptionPlan String? // 'hobby', 'pro'
sendNewsletter Boolean @default(false)

View File

@@ -41,7 +41,6 @@ function generateMockUserData(): MockUserData {
lemonSqueezyCustomerPortalUrl: null,
paymentProcessorUserId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
datePaid: hasUserPaidOnStripe ? faker.date.between({ from: createdAt, to: lastActiveTimestamp }) : null,
checkoutSessionId: hasUserPaidOnStripe ? `cs_test_${faker.string.uuid()}` : null,
subscriptionPlan: subscriptionStatus ? faker.helpers.arrayElement(getSubscriptionPaymentPlanIds()) : null,
};
}