refactor: update assignment service methods for pagination support
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user