@@ -50,7 +50,7 @@ export const updateSubscriptionQuantityInternal = mutation({
5050 . unique ( ) ;
5151
5252 if ( subscription ) {
53- await ctx . db . patch ( subscription . _id , {
53+ await ctx . db . patch ( "subscriptions" , subscription . _id , {
5454 quantity : args . quantity ,
5555 } ) ;
5656 }
@@ -108,7 +108,7 @@ export const handleCustomerUpdated = mutation({
108108 . unique ( ) ;
109109
110110 if ( customer ) {
111- await ctx . db . patch ( customer . _id , {
111+ await ctx . db . patch ( "customers" , customer . _id , {
112112 email : args . email ,
113113 name : args . name ,
114114 metadata : args . metadata ,
@@ -187,7 +187,7 @@ export const handleSubscriptionCreated = mutation({
187187
188188 for ( const invoice of invoices ) {
189189 if ( ! invoice . orgId || ! invoice . userId ) {
190- await ctx . db . patch ( invoice . _id , {
190+ await ctx . db . patch ( "invoices" , invoice . _id , {
191191 ...( orgId && ! invoice . orgId && { orgId } ) ,
192192 ...( userId && ! invoice . userId && { userId } ) ,
193193 } ) ;
@@ -228,7 +228,7 @@ export const handleSubscriptionUpdated = mutation({
228228 const cancelAtPeriodEnd = args . cancelAtPeriodEnd ||
229229 deriveCancelAtPeriodEnd ( args . cancelAt , args . currentPeriodEnd ) ;
230230
231- await ctx . db . patch ( subscription . _id , {
231+ await ctx . db . patch ( "subscriptions" , subscription . _id , {
232232 status : args . status ,
233233 currentPeriodEnd : args . currentPeriodEnd ,
234234 cancelAtPeriodEnd : cancelAtPeriodEnd ,
@@ -263,7 +263,7 @@ export const handleSubscriptionDeleted = mutation({
263263 . unique ( ) ;
264264
265265 if ( subscription ) {
266- await ctx . db . patch ( subscription . _id , {
266+ await ctx . db . patch ( "subscriptions" , subscription . _id , {
267267 status : "canceled" ,
268268 ...( args . cancelAtPeriodEnd !== undefined && {
269269 cancelAtPeriodEnd : args . cancelAtPeriodEnd ,
@@ -296,7 +296,7 @@ export const handleCheckoutSessionCompleted = mutation({
296296 . unique ( ) ;
297297
298298 if ( existing ) {
299- await ctx . db . patch ( existing . _id , {
299+ await ctx . db . patch ( "checkout_sessions" , existing . _id , {
300300 status : "complete" ,
301301 stripeCustomerId : args . stripeCustomerId ,
302302 } ) ;
@@ -384,7 +384,7 @@ export const handleInvoicePaid = mutation({
384384 . unique ( ) ;
385385
386386 if ( invoice ) {
387- await ctx . db . patch ( invoice . _id , {
387+ await ctx . db . patch ( "invoices" , invoice . _id , {
388388 status : "paid" ,
389389 amountPaid : args . amountPaid ,
390390 } ) ;
@@ -408,7 +408,7 @@ export const handleInvoicePaymentFailed = mutation({
408408 . unique ( ) ;
409409
410410 if ( invoice ) {
411- await ctx . db . patch ( invoice . _id , {
411+ await ctx . db . patch ( "invoices" , invoice . _id , {
412412 status : "open" ,
413413 } ) ;
414414 }
@@ -455,7 +455,7 @@ export const handlePaymentIntentSucceeded = mutation({
455455 } ) ;
456456 } else if ( args . stripeCustomerId && ! existing . stripeCustomerId ) {
457457 // Update customer ID if it wasn't set initially (webhook timing issue)
458- await ctx . db . patch ( existing . _id , {
458+ await ctx . db . patch ( "payments" , existing . _id , {
459459 stripeCustomerId : args . stripeCustomerId ,
460460 } ) ;
461461 }
@@ -479,7 +479,7 @@ export const updatePaymentCustomer = mutation({
479479 . unique ( ) ;
480480
481481 if ( payment && ! payment . stripeCustomerId ) {
482- await ctx . db . patch ( payment . _id , {
482+ await ctx . db . patch ( "payments" , payment . _id , {
483483 stripeCustomerId : args . stripeCustomerId ,
484484 } ) ;
485485 }
0 commit comments