refactor: update assignment service methods for pagination support

This commit is contained in:
2025-11-12 16:59:39 +01:00
parent f668b6f006
commit 2d8d0e663e
2 changed files with 21 additions and 2 deletions
+20 -1
View File
@@ -7,7 +7,26 @@ import { Assignment, AssignmentWithRecipientItemAsset } from "@/lib/types"
import { getAuthenticatedUserId } from "./auth.service"
export const AssignmentService = {
findAllWithRecipient: async ({
findAllWithRecipient: async (): Promise<
AssignmentWithRecipientItemAsset[]
> => {
return prisma.assignment.findMany({
where: {
returnDate: {
equals: null,
},
},
include: {
recipient: true,
item: true,
asset: true,
},
orderBy: {
createdAt: "desc",
},
})
},
findAllWithRecipientPaginated: async ({
page,
pageSize,
search,