File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/trpc/routers/billing-router/procedures Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export const getSubscriptionProcedure = withAuth.query(async ({ ctx }) => {
7
7
const { subscription } = await db . $transaction ( async ( tx ) => {
8
8
const { companyId } = await checkMembership ( { session, tx } ) ;
9
9
10
- const customer = await db . billingCustomer . findFirst ( {
10
+ const customer = await tx . billingCustomer . findFirst ( {
11
11
where : {
12
12
companyId,
13
13
} ,
@@ -20,13 +20,24 @@ export const getSubscriptionProcedure = withAuth.query(async ({ ctx }) => {
20
20
return { subscription : null } ;
21
21
}
22
22
23
- const subscription = await db . billingSubscription . findFirst ( {
23
+ const subscription = await tx . billingSubscription . findFirst ( {
24
24
where : {
25
25
customerId : customer . id ,
26
26
status : {
27
27
in : [ "active" , "trialing" ] ,
28
28
} ,
29
29
} ,
30
+ include : {
31
+ price : {
32
+ select : {
33
+ product : {
34
+ select : {
35
+ name : true ,
36
+ } ,
37
+ } ,
38
+ } ,
39
+ } ,
40
+ } ,
30
41
} ) ;
31
42
32
43
return { subscription } ;
You can’t perform that action at this time.
0 commit comments