Skip to content

Commit 5accc8b

Browse files
chore: wip
1 parent 11784a5 commit 5accc8b

File tree

19 files changed

+91
-34
lines changed

19 files changed

+91
-34
lines changed

app/Actions/Payment/UpdateDefaultPaymentMethodAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default new Action({
1010
const userId = Number(request.getParam('id'))
1111
const user = await User.find(userId)
1212

13-
const paymentMethod = request.get('paymentMethod') as string
13+
const paymentMethod = Number(request.get('paymentMethod'))
1414

1515
await user?.setDefaultPaymentMethod(paymentMethod)
1616
},

resources/functions/billing/payments.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ export function useBillable() {
5757
else {
5858
await paymentStore.storePaymentMethod(setupIntent.payment_method)
5959

60-
if (!paymentStore.hasPaymentMethods)
60+
if (!paymentStore.hasPaymentMethods)
6161
await paymentStore.setUserDefaultPaymentMethod(setupIntent.payment_method)
62-
6362
}
6463
}
6564

resources/stores/payment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export const usePaymentStore = defineStore('payment', {
200200
if (response.status !== 204) {
201201
const res = await response.json()
202202

203+
console.log(res)
203204
this.paymentMethods = res
204205
}
205206

resources/views/dashboard/components/billing/payment-method-list.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ async function makeDefault(paymentMethodId: number) {
2929
3030
await paymentStore.updateDefaultPaymentMethod(paymentMethodId)
3131
32-
await paymentStore.fetchUserPaymentMethods()
33-
await paymentStore.fetchDefaultPaymentMethod()
32+
await paymentStore.fetchUserPaymentMethods(1)
33+
await paymentStore.fetchDefaultPaymentMethod(1)
3434
3535
isDefaultLoading.value[paymentMethodId] = false
3636
}

storage/framework/core/orm/src/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,13 +1920,17 @@ export async function generateModelString(
19201920
static whereNull(column: string): ${modelName}Model {
19211921
const instance = new ${modelName}Model(null)
19221922
1923-
instance.query = instance.query.where(column, 'is', null)
1923+
instance.query = instance.query.where((eb: any) =>
1924+
eb(column, '=', '').or(column, 'is', null)
1925+
)
19241926
19251927
return instance
19261928
}
19271929
19281930
whereNull(column: string): ${modelName}Model {
1929-
this.query = this.query.where(column, 'is', null)
1931+
this.query = this.query.where((eb: any) =>
1932+
eb(column, '=', '').or(column, 'is', null)
1933+
)
19301934
19311935
return this
19321936
}

storage/framework/core/payments/src/billable/payment-method.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ export const managePaymentMethod: ManagePaymentMethod = (() => {
8989
},
9090
})
9191

92+
pm?.update({ is_default: true })
93+
9294
return updatedCustomer
9395
}
9496

@@ -124,7 +126,6 @@ export const managePaymentMethod: ManagePaymentMethod = (() => {
124126
return paymentMethod as PaymentMethodModel
125127
}
126128

127-
128129
async function deletePaymentMethod(user: UserModel, paymentMethodId: number): Promise<Stripe.Response<Stripe.PaymentMethod>> {
129130
if (!user.hasStripeId()) {
130131
throw new Error('Customer does not exist in Stripe')

storage/framework/orm/src/models/AccessToken.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,17 @@ export class AccessTokenModel {
374374
static whereNull(column: string): AccessTokenModel {
375375
const instance = new AccessTokenModel(null)
376376

377-
instance.query = instance.query.where(column, 'is', null)
377+
instance.query = instance.query.where((eb: any) =>
378+
eb(column, '=', '').or(column, 'is', null),
379+
)
378380

379381
return instance
380382
}
381383

382384
whereNull(column: string): AccessTokenModel {
383-
this.query = this.query.where(column, 'is', null)
385+
this.query = this.query.where((eb: any) =>
386+
eb(column, '=', '').or(column, 'is', null),
387+
)
384388

385389
return this
386390
}

storage/framework/orm/src/models/Deployment.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,17 @@ export class DeploymentModel {
393393
static whereNull(column: string): DeploymentModel {
394394
const instance = new DeploymentModel(null)
395395

396-
instance.query = instance.query.where(column, 'is', null)
396+
instance.query = instance.query.where((eb: any) =>
397+
eb(column, '=', '').or(column, 'is', null),
398+
)
397399

398400
return instance
399401
}
400402

401403
whereNull(column: string): DeploymentModel {
402-
this.query = this.query.where(column, 'is', null)
404+
this.query = this.query.where((eb: any) =>
405+
eb(column, '=', '').or(column, 'is', null),
406+
)
403407

404408
return this
405409
}

storage/framework/orm/src/models/Error.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,17 @@ export class ErrorModel {
374374
static whereNull(column: string): ErrorModel {
375375
const instance = new ErrorModel(null)
376376

377-
instance.query = instance.query.where(column, 'is', null)
377+
instance.query = instance.query.where((eb: any) =>
378+
eb(column, '=', '').or(column, 'is', null),
379+
)
378380

379381
return instance
380382
}
381383

382384
whereNull(column: string): ErrorModel {
383-
this.query = this.query.where(column, 'is', null)
385+
this.query = this.query.where((eb: any) =>
386+
eb(column, '=', '').or(column, 'is', null),
387+
)
384388

385389
return this
386390
}

storage/framework/orm/src/models/PaymentMethod.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,17 @@ export class PaymentMethodModel {
393393
static whereNull(column: string): PaymentMethodModel {
394394
const instance = new PaymentMethodModel(null)
395395

396-
instance.query = instance.query.where(column, 'is', null)
396+
instance.query = instance.query.where((eb: any) =>
397+
eb(column, '=', '').or(column, 'is', null),
398+
)
397399

398400
return instance
399401
}
400402

401403
whereNull(column: string): PaymentMethodModel {
402-
this.query = this.query.where(column, 'is', null)
404+
this.query = this.query.where((eb: any) =>
405+
eb(column, '=', '').or(column, 'is', null),
406+
)
403407

404408
return this
405409
}

storage/framework/orm/src/models/Post.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,17 @@ export class PostModel {
368368
static whereNull(column: string): PostModel {
369369
const instance = new PostModel(null)
370370

371-
instance.query = instance.query.where(column, 'is', null)
371+
instance.query = instance.query.where((eb: any) =>
372+
eb(column, '=', '').or(column, 'is', null),
373+
)
372374

373375
return instance
374376
}
375377

376378
whereNull(column: string): PostModel {
377-
this.query = this.query.where(column, 'is', null)
379+
this.query = this.query.where((eb: any) =>
380+
eb(column, '=', '').or(column, 'is', null),
381+
)
378382

379383
return this
380384
}

storage/framework/orm/src/models/Product.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,17 @@ export class ProductModel {
389389
static whereNull(column: string): ProductModel {
390390
const instance = new ProductModel(null)
391391

392-
instance.query = instance.query.where(column, 'is', null)
392+
instance.query = instance.query.where((eb: any) =>
393+
eb(column, '=', '').or(column, 'is', null),
394+
)
393395

394396
return instance
395397
}
396398

397399
whereNull(column: string): ProductModel {
398-
this.query = this.query.where(column, 'is', null)
400+
this.query = this.query.where((eb: any) =>
401+
eb(column, '=', '').or(column, 'is', null),
402+
)
399403

400404
return this
401405
}

storage/framework/orm/src/models/Project.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,17 @@ export class ProjectModel {
368368
static whereNull(column: string): ProjectModel {
369369
const instance = new ProjectModel(null)
370370

371-
instance.query = instance.query.where(column, 'is', null)
371+
instance.query = instance.query.where((eb: any) =>
372+
eb(column, '=', '').or(column, 'is', null),
373+
)
372374

373375
return instance
374376
}
375377

376378
whereNull(column: string): ProjectModel {
377-
this.query = this.query.where(column, 'is', null)
379+
this.query = this.query.where((eb: any) =>
380+
eb(column, '=', '').or(column, 'is', null),
381+
)
378382

379383
return this
380384
}

storage/framework/orm/src/models/Release.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,17 @@ export class ReleaseModel {
359359
static whereNull(column: string): ReleaseModel {
360360
const instance = new ReleaseModel(null)
361361

362-
instance.query = instance.query.where(column, 'is', null)
362+
instance.query = instance.query.where((eb: any) =>
363+
eb(column, '=', '').or(column, 'is', null),
364+
)
363365

364366
return instance
365367
}
366368

367369
whereNull(column: string): ReleaseModel {
368-
this.query = this.query.where(column, 'is', null)
370+
this.query = this.query.where((eb: any) =>
371+
eb(column, '=', '').or(column, 'is', null),
372+
)
369373

370374
return this
371375
}

storage/framework/orm/src/models/Subscriber.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,17 @@ export class SubscriberModel {
363363
static whereNull(column: string): SubscriberModel {
364364
const instance = new SubscriberModel(null)
365365

366-
instance.query = instance.query.where(column, 'is', null)
366+
instance.query = instance.query.where((eb: any) =>
367+
eb(column, '=', '').or(column, 'is', null),
368+
)
367369

368370
return instance
369371
}
370372

371373
whereNull(column: string): SubscriberModel {
372-
this.query = this.query.where(column, 'is', null)
374+
this.query = this.query.where((eb: any) =>
375+
eb(column, '=', '').or(column, 'is', null),
376+
)
373377

374378
return this
375379
}

storage/framework/orm/src/models/SubscriberEmail.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,17 @@ export class SubscriberEmailModel {
363363
static whereNull(column: string): SubscriberEmailModel {
364364
const instance = new SubscriberEmailModel(null)
365365

366-
instance.query = instance.query.where(column, 'is', null)
366+
instance.query = instance.query.where((eb: any) =>
367+
eb(column, '=', '').or(column, 'is', null),
368+
)
367369

368370
return instance
369371
}
370372

371373
whereNull(column: string): SubscriberEmailModel {
372-
this.query = this.query.where(column, 'is', null)
374+
this.query = this.query.where((eb: any) =>
375+
eb(column, '=', '').or(column, 'is', null),
376+
)
373377

374378
return this
375379
}

storage/framework/orm/src/models/Subscription.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,17 @@ export class SubscriptionModel {
402402
static whereNull(column: string): SubscriptionModel {
403403
const instance = new SubscriptionModel(null)
404404

405-
instance.query = instance.query.where(column, 'is', null)
405+
instance.query = instance.query.where((eb: any) =>
406+
eb(column, '=', '').or(column, 'is', null),
407+
)
406408

407409
return instance
408410
}
409411

410412
whereNull(column: string): SubscriptionModel {
411-
this.query = this.query.where(column, 'is', null)
413+
this.query = this.query.where((eb: any) =>
414+
eb(column, '=', '').or(column, 'is', null),
415+
)
412416

413417
return this
414418
}

storage/framework/orm/src/models/Team.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,17 @@ export class TeamModel {
391391
static whereNull(column: string): TeamModel {
392392
const instance = new TeamModel(null)
393393

394-
instance.query = instance.query.where(column, 'is', null)
394+
instance.query = instance.query.where((eb: any) =>
395+
eb(column, '=', '').or(column, 'is', null),
396+
)
395397

396398
return instance
397399
}
398400

399401
whereNull(column: string): TeamModel {
400-
this.query = this.query.where(column, 'is', null)
402+
this.query = this.query.where((eb: any) =>
403+
eb(column, '=', '').or(column, 'is', null),
404+
)
401405

402406
return this
403407
}

storage/framework/orm/src/models/User.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,17 @@ export class UserModel {
419419
static whereNull(column: string): UserModel {
420420
const instance = new UserModel(null)
421421

422-
instance.query = instance.query.where(column, 'is', null)
422+
instance.query = instance.query.where((eb: any) =>
423+
eb(column, '=', '').or(column, 'is', null),
424+
)
423425

424426
return instance
425427
}
426428

427429
whereNull(column: string): UserModel {
428-
this.query = this.query.where(column, 'is', null)
430+
this.query = this.query.where((eb: any) =>
431+
eb(column, '=', '').or(column, 'is', null),
432+
)
429433

430434
return this
431435
}

0 commit comments

Comments
 (0)