Skip to content

Commit cbe8e46

Browse files
committed
chore: add plan name
1 parent 9acd0f8 commit cbe8e46

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/trpc/routers/billing-router/procedures/get-subscription.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getSubscriptionProcedure = withAuth.query(async ({ ctx }) => {
77
const { subscription } = await db.$transaction(async (tx) => {
88
const { companyId } = await checkMembership({ session, tx });
99

10-
const customer = await db.billingCustomer.findFirst({
10+
const customer = await tx.billingCustomer.findFirst({
1111
where: {
1212
companyId,
1313
},
@@ -20,13 +20,24 @@ export const getSubscriptionProcedure = withAuth.query(async ({ ctx }) => {
2020
return { subscription: null };
2121
}
2222

23-
const subscription = await db.billingSubscription.findFirst({
23+
const subscription = await tx.billingSubscription.findFirst({
2424
where: {
2525
customerId: customer.id,
2626
status: {
2727
in: ["active", "trialing"],
2828
},
2929
},
30+
include: {
31+
price: {
32+
select: {
33+
product: {
34+
select: {
35+
name: true,
36+
},
37+
},
38+
},
39+
},
40+
},
3041
});
3142

3243
return { subscription };

0 commit comments

Comments
 (0)