Skip to content

Commit 6b4ef0f

Browse files
committed
refactor: clean up
1 parent 39371f9 commit 6b4ef0f

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

services/invoiceService.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,8 @@ export async function getNewInvoiceNumber (userId: string): Promise<string | und
9494
})
9595
const invoicesWithOurPattern = userInvoices.filter(invoice => defaultPattern.test(invoice.invoiceNumber))
9696

97-
if (invoicesWithOurPattern === null) {
98-
const invoicesCount = await prisma.invoice.count({
99-
where: {
100-
userId
101-
}
102-
})
103-
if (invoicesCount > 0) {
97+
if (invoicesWithOurPattern === null || invoicesWithOurPattern.length < userInvoices.length) {
98+
if (userInvoices.length > 0) {
10499
return
105100
}
106101
}

0 commit comments

Comments
 (0)