Eduardo Maíllo Conesa
08/18/2022, 3:54 PMasync byConditionAndType(
accountId: string,
input: PatientDataLogGetInput,
take?: number,
cursor?: Prisma.DataLogWhereUniqueInput,
): Promise<DataLog[]> {
return await this.prisma.dataLog.findMany({
take,
skip: 1,
cursor,
where: {
accountId: accountId,
condition: input.condition,
logType: input.logType,
},
orderBy: {
createdAt: 'desc',
},
});
}
The resolver:
@Query(() => [OutputType])
async getDataLogsByConditionAndType(
@Args('input') input: DataLogGetInput,
@Args('take') take?: number,
@Args('cursor') cursor?: Prisma.PatientDataLogWhereUniqueInput,
): Promise<DataLog[]> {
const accountId = context.req.user?.accountId;
try {
return await this.dataLogService.byConditionAndType(accountId, input, take, cursor);
} catch (e) {
throw new ApolloError(e.message);
}
}
The Error:
Undefined type error. Make sure you are providing an explicit type for the "getDataLogsByConditionAndType" (parameter at index [3]) of the "DataLogResolver" class.
What type should cursor
be in the resolver endpoint to align with the method making the prisma query?
The cursor is the id column if the table (uuidv4)
bty, I am following this article (cursor pagination section)
Thanks !!!