Rewrite generated resolver


#1

Hi there! I’m trying to rewrite a generated resolver.

Here’s a generated resolver:

const PrismaQueries = prismaObjectType({
name: "Query",
definition(t) {
t.prismaFields([
  "roomsConnection"
]);
}
});

I’m trying to use that generated resolver, but change the logic for a bit:

export const roomsConnection = queryField('roomsConnection', {
type: 'RoomConnection',
async resolve(_parent, args:any, { prisma }) {
const newReturn = {
  pageInfo: prisma.roomsConnection(args).pageInfo(),
  edges: prisma.roomsConnection(args).edges(),
  aggregate: prisma.roomsConnection(args).aggregate()
}
return newReturn
}
});

The last thing that I need to make work is the args, it requires all args like where, last etc.

Is there a way how can i take these generated args and re-use them? Something like:

import { NexusGenArgTypes } from '../../generated/nexus';
const reusedArgs: NexusGenArgTypes["Query"]["usersConnection"] = {};

Thanks a lot!


#2

hey I have a question, if a content is re-written on a rewriting site. Can I use it on my site without being plagrised? By the way if you are looking for best SMO Service in Australia, visit SMO Services Australia.


#3

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.