fix: awaiting in promise.all array

This commit is contained in:
Mythie
2023-12-21 17:36:35 +11:00
parent 268a5c6508
commit 298396c86c

View File

@ -8,7 +8,7 @@ export type GetTemplatesOptions = {
export const getTemplates = async ({ userId, page = 1, perPage = 10 }: GetTemplatesOptions) => { export const getTemplates = async ({ userId, page = 1, perPage = 10 }: GetTemplatesOptions) => {
const [templates, count] = await Promise.all([ const [templates, count] = await Promise.all([
await prisma.template.findMany({ prisma.template.findMany({
where: { where: {
userId, userId,
}, },
@ -21,11 +21,9 @@ export const getTemplates = async ({ userId, page = 1, perPage = 10 }: GetTempla
createdAt: 'desc', createdAt: 'desc',
}, },
}), }),
await prisma.template.count({ prisma.template.count({
where: { where: {
User: { userId,
id: userId,
},
}, },
}), }),
]); ]);