We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 39371f9 commit 6b4ef0fCopy full SHA for 6b4ef0f
1 file changed
services/invoiceService.ts
@@ -94,13 +94,8 @@ export async function getNewInvoiceNumber (userId: string): Promise<string | und
94
})
95
const invoicesWithOurPattern = userInvoices.filter(invoice => defaultPattern.test(invoice.invoiceNumber))
96
97
- if (invoicesWithOurPattern === null) {
98
- const invoicesCount = await prisma.invoice.count({
99
- where: {
100
- userId
101
- }
102
- })
103
- if (invoicesCount > 0) {
+ if (invoicesWithOurPattern === null || invoicesWithOurPattern.length < userInvoices.length) {
+ if (userInvoices.length > 0) {
104
return
105
}
106
0 commit comments