Replace updates with updateManys when possible

Easy performance win to avoid triggering SELECT query after an UPDATE
This commit is contained in:
Baptiste Arnaud
2023-07-16 18:52:30 +02:00
parent 12ce4eb01b
commit 3426d6689d
13 changed files with 21 additions and 28 deletions

View File

@@ -36,11 +36,6 @@ export const getUsage = authenticatedProcedure
const now = new Date()
const firstDayOfMonth = new Date(now.getFullYear(), now.getMonth(), 1)
const firstDayOfNextMonth = new Date(
now.getFullYear(),
now.getMonth() + 1,
1
)
const [
totalChatsUsed,
{
@@ -62,7 +57,6 @@ export const getUsage = authenticatedProcedure
hasStarted: true,
createdAt: {
gte: firstDayOfMonth,
lt: firstDayOfNextMonth,
},
},
}),