update pagination
This commit is contained in:
@@ -30,4 +30,34 @@ export class WorkshopMeetingRoomSchema extends PothosSchema {
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
workshopMeetingRoom: t.prismaField({
|
||||
type: this.workshopMeetingRoom(),
|
||||
args: this.builder.generator.findUniqueArgs('WorkshopMeetingRoom'),
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.workshopMeetingRoom.findUnique({
|
||||
...query,
|
||||
where: args.where,
|
||||
});
|
||||
},
|
||||
}),
|
||||
workshopMeetingRooms: t.prismaField({
|
||||
type: [this.workshopMeetingRoom()],
|
||||
args: this.builder.generator.findManyArgs('WorkshopMeetingRoom'),
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.workshopMeetingRoom.findMany({
|
||||
...query,
|
||||
where: args.filter ?? undefined,
|
||||
orderBy: args.orderBy ?? undefined,
|
||||
cursor: args.cursor ?? undefined,
|
||||
take: args.take ?? 10,
|
||||
skip: args.skip ?? undefined,
|
||||
});
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user