Joël
Joël
Daniell
12/15/2020, 2:34 PMCurio
12/15/2020, 3:18 PMexport const DashboardQuery = extendType({
type: 'Query',
definition(t) {
// counts
t.int('countUsers', {
resolve(_parent, args, ctx) {
return ctx.prisma.user.count({where: {active: {equals: false}}})
},
})
t.int('countPosts', {
resolve(_parent, args, ctx) {
return ctx.prisma.post.count({where: {active: {equals: false}}})
},
})
},
})
And i would like this to have it like this in the graphql server?
counts {
countUsers
countPosts
}
Darryl
12/16/2020, 10:58 AMtypegenAutoConfig
no longer needed/supported in makeSchema
? I just migrated my project and noticed:
'typegenAutoConfig' does not exist in type 'SchemaConfig'
It's also no longer in the docs. Maybe I've missed something but I didn't see anything saying it should be removed so I just wanted to check here. Thanks.Dickson
12/17/2020, 8:53 AMNitgo
12/17/2020, 5:42 PM(property) Options.experimentalCRUD?: boolean | undefined
Enable experimental CRUD capabilities. Add a t.crud method in your definition block to generate CRUD resolvers in your Query and Mutation GraphQL Object Type.
@default
false
Type 'import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/nexus/dist/plugin").NexusPlugin' is not assignable to type 'import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/@nexus/schema/dist/plugin").NexusPlugin'.
The types of 'config.fieldDefTypes' are incompatible between these types.
Type 'string | import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/nexus/dist/utils").PrintedGenTypingImport | import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/nexus/dist/utils").PrintedGenTyping | import("/Users/soft_orca/fulls-projects/complete-intro-t...' is not assignable to type 'string | import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/@nexus/schema/dist/utils").PrintedGenTypingImport | import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/@nexus/schema/dist/utils").PrintedGenTyping | import("/Users/soft_orca/fulls-projects/...'.
Type 'PrintedGenTyping' is not assignable to type 'string | PrintedGenTypingImport | PrintedGenTyping | StringLike[] | undefined'.
Type 'import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/nexus/dist/utils").PrintedGenTyping' is not assignable to type 'import("/Users/soft_orca/fulls-projects/complete-intro-typesafe-graphql/node_modules/@nexus/schema/dist/utils").PrintedGenTyping'.
Property 'config' is protected but type 'PrintedGenTyping' is not a class derived from 'PrintedGenTyping'.ts(2322)
Thomas Ladd
12/18/2020, 12:51 AMbackingTypes
so that the DateTime scalar had type Date
in NexusGenScalars. It looks like that option is gone now so I end up with a NexusGenScalars
where DateTime maps to any
.
export interface NexusGenScalars {
String: string;
Int: number;
Float: number;
Boolean: boolean;
ID: string;
DateTime: any;
}
Is there a new way to get a more specific type here for DateTime
?Chris Kjær
12/18/2020, 8:37 AMid
fields. I thought that I could add a resolver for the ID
or UUID
scalar but just realised that all ids are resolved to Int/String. I thought that they would be resolved to the scalars mentioned here https://nexusjs.org/docs/plugins/prisma/api#scalarDaniell
12/18/2020, 5:23 PMAdam
12/18/2020, 10:19 PMcreate
and connectOrCreate
when connecting
an entity to another? Specifically for the generated InputTypes
for graphql?Stefan Trivuncic
12/19/2020, 3:29 PMEric Reis
12/19/2020, 3:49 PMexport const products = queryField('products', () => ({
type: 'products',
resolve: async (_, args, { pg, checkAuth }) => {
await checkAuth();
return findProducts(pg, args);
},
}));
Eric Reis
12/19/2020, 3:49 PMAdam
12/21/2020, 7:50 PMERROR: @nexus/schema must be installed as a dependency. Please run npm install @nexus/schema
after replacing @nexus/schema
with nexus
I saw that @nexus/schema
was renamed to nexus
so I brought that into my project as a direct replacement for @nexus/schema
my makeSchema
config now has the syntax error 'typegenAutoConfig' does not exist in type 'SchemaConfig'.ts
and when I try and run it ignoring this error it yells at me to install @nexus/schema
I'm running @prisma/cli@2.13.0
@prisma/client@2.13.0
nexus-plugin-prisma@0.25.0
and nexus@1.0.0
I noticed the docs on prisma just show this as importing some 'types' file and the link to the repo shows a 404 https://nexusjs.org/docs/plugins/prisma/overview
return makeSchema({
typegenAutoConfig: {
sources: [
{
source: '@prisma/client',
alias: 'prisma',
},
{
source: require.resolve('./context'),
alias: 'ContextModule',
},
],
contextType: 'ContextModule.Context',
},
outputs: {
John Smeeth
12/22/2020, 8:54 AMJohn Smeeth
12/22/2020, 8:57 AM"build": "npm -s run clean && npm -s run generate && tsc"
) I got error as this
src/generated/nexus.ts:1324:26 - error TS2339: Property 'CategoriesOnPostsUpdateManyMutationInput' does not exist on type 'NexusGenInputs'.
John Smeeth
12/22/2020, 8:58 AMJohn Smeeth
12/22/2020, 8:58 AM"nexus": "^1.0.0",
"nexus-plugin-prisma": "^0.27.0",
"@prisma/client": "^2.13.0",
Victor
12/22/2020, 4:58 PMoriginalResolve
as mentioned in this example here?
My code would look like this:
export const UserPortfolioVersion = objectType({
name: "UserPortfolioVersion",
definition(t) {
t.model.id();
t.model.UserPortfolioInstrument({
resolve: async (root, args, ctx, info, originalResolve) => {
// mutate the context
ctx.metadata = {
totalValue: 10000, // I need to be able to access this number in the child resolver
};
const res = await originalResolve(root, args, ctx, info);
return res;
},
});
},
});
Tyson
12/23/2020, 11:48 PMJohn Smeeth
12/27/2020, 11:46 AMAdam
12/29/2020, 5:53 PMUser
with a Role
field that is text, can I block that from ever being updated thru grapql
?Stefan N
12/30/2020, 10:25 AMplugins: [
nexusPrisma({
...
shouldGenerateArtifacts: process.env.NODE_ENV === "development",
...
}),
],
I'm running this on next.js with Fast Refresh enabled. The newly generated artifacts will in turn will let next.js think it will need to hot reload. And lastly since a while on each hot reload prisma is starting a new connection pool. So after a few hours of development there are too many active connections on postgres. Not sure where things start to go wrong 🤷♂️Can Rozanes
12/30/2020, 3:21 PMcreatedAt
and updatedAt
fields.
When I declare a type associated with this on nexus ie:
export const User = objectType({
name: "User",
definition(t) {
<http://t.nonNull.int|t.nonNull.int>("id");
t.nonNull.string("name");
t.nonNull.string("email");
t.nonNull.string("createdAt");
t.nonNull.string("updatedAt");
},
});
I end up getting type error in user resolvers:
Type 'Date' is not assignable to type 'string'
slinden
01/01/2021, 9:55 PMcontextType
for the nexus schema. I posted a question in Stack Overflow. It's probably easy to fix, but I just dont see it or dont have the knowledge to solve the problem. https://stackoverflow.com/questions/65532634/correct-way-to-define-contexttype-in-nexusjs-while-using-nextjsslinden
01/01/2021, 9:55 PMManthan Mallikarjun
01/02/2021, 1:02 AMUnknown type Int provided in nullabilityGuard fallbackValues config.
Manthan Mallikarjun
01/02/2021, 1:02 AMManthan Mallikarjun
01/02/2021, 1:02 AM