chore: apply Biome cleanup

This commit is contained in:
2026-06-11 04:56:01 +02:00
parent ac3dfe69cd
commit 18a192a069
11 changed files with 41 additions and 32 deletions
+20 -8
View File
@@ -1,14 +1,25 @@
import type { Prisma } from "@/generated/prisma/client"
import type { PaginatedResult } from "@/types"
type PaginationModel<T> = {
findMany(args: {
where?: unknown
skip: number
take: number
orderBy?: unknown
include?: unknown
select?: unknown
}): Promise<T[]>
count(args: { where?: unknown }): Promise<number>
}
type PaginationArgs<_T> = {
model: any
where?: Prisma.Enumerable<any>
model: unknown
where?: unknown
page?: number
pageSize?: number
orderBy?: any
include?: Prisma.Enumerable<any>
select?: Prisma.Enumerable<any>
orderBy?: unknown
include?: unknown
select?: unknown
}
export async function paginate<T>({
@@ -21,9 +32,10 @@ export async function paginate<T>({
select,
}: PaginationArgs<T>): Promise<PaginatedResult<T>> {
const skip = (page - 1) * pageSize
const paginatedModel = model as PaginationModel<T>
const [data, totalItems] = await Promise.all([
model.findMany({
paginatedModel.findMany({
where,
skip,
take: pageSize,
@@ -31,7 +43,7 @@ export async function paginate<T>({
include,
select,
}),
model.count({ where }),
paginatedModel.count({ where }),
])
return {