Skip to content

Commit

Permalink
fix: add statuses to user getInvoices
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvanherwijnen committed Nov 12, 2024
1 parent 110762d commit 57577a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@fastify/cors": "^10.0.1",
"@fastify/middie": "9.0.2",
"@fastify/static": "8.0.2",
"@modular-api/api": "^0.5.11",
"@modular-api/api": "^0.5.12",
"@modular-api/fastify-cart": "^0.3.1",
"@modular-api/fastify-checkout": "^0.4.8",
"@modular-api/fastify-checkout": "^0.4.9",
"@modular-api/fastify-oidc": "^0.6.1",
"@mollie/api-client": "^4.1.0",
"@slimfact/app": "^0.1.0",
Expand Down
14 changes: 4 additions & 10 deletions packages/api/src/trpc/user/invoices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TRPCError } from '@trpc/server'
import { t } from '../index.js'
import type { FastifyInstance } from 'fastify'
import { findClient } from 'src/repositories/client.js'
Expand All @@ -21,6 +20,7 @@ export const userInvoiceRoutes = ({
})
if (client?.id) {
const invoices = await fastify.checkout.invoiceHandler.getInvoices({
statuses: [InvoiceStatus.OPEN, InvoiceStatus.PAID],
clientId: client.id,
options: {
withPayments: true,
Expand All @@ -33,9 +33,7 @@ export const userInvoiceRoutes = ({
return invoices
}
}
throw new TRPCError({
code: 'BAD_REQUEST'
})
return []
}),
getReceipts: procedure.query(async ({ ctx }) => {
if (fastify.checkout?.invoiceHandler) {
Expand All @@ -60,9 +58,7 @@ export const userInvoiceRoutes = ({
return invoices
}
}
throw new TRPCError({
code: 'BAD_REQUEST'
})
return []
}),
getBills: procedure.query(async ({ ctx }) => {
if (fastify.checkout?.invoiceHandler) {
Expand All @@ -87,8 +83,6 @@ export const userInvoiceRoutes = ({
return invoices
}
}
throw new TRPCError({
code: 'BAD_REQUEST'
})
return []
})
})
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@modular-api/fastify-cart": "^0.3.1",
"@modular-api/fastify-checkout": "^0.4.8",
"@modular-api/fastify-checkout": "^0.4.9",
"@modular-api/quasar-components": "^0.3.4",
"@quasar/extras": "1.16.12",
"@quasar/quasar-ui-qcalendar": "4.0.0-beta.16",
Expand Down
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57577a8

Please sign in to comment.