aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2023-12-07 20:54:11 -0500
committerSebastien Castiel <sebastien@castiel.me>2023-12-07 20:57:48 -0500
commit0e7b879aa8d771b58fc5783f78f981cb29432361 (patch)
tree30d04a9c8894bc2215abbfb9dfdc32dcd06f4349 /src/lib
parent6f077f141edcc45f2d7467b7c796e62a8f0316f8 (diff)
Redesign the groups page
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/api.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 2968cae..34e4473 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -1,5 +1,6 @@
import { getPrisma } from '@/lib/prisma'
import { ExpenseFormValues, GroupFormValues } from '@/lib/schemas'
+import { delay } from '@/lib/utils'
import { Expense } from '@prisma/client'
import { v4 as uuidv4 } from 'uuid'
@@ -78,6 +79,15 @@ export async function getGroupExpensesParticipants(groupId: string) {
)
}
+export async function getGroups(groupIds: string[]) {
+ await delay(2000)
+ const prisma = await getPrisma()
+ return prisma.group.findMany({
+ where: { id: { in: groupIds } },
+ include: { _count: { select: { participants: true } } },
+ })
+}
+
export async function updateExpense(
groupId: string,
expenseId: string,