jasonkuhrt
César Rodríguez
08/12/2019, 12:11 PMjasonkuhrt
nexus-prisma
), would love your feedback https://github.com/prisma/nexus/pull/205tafelito
08/27/2019, 9:25 PMjasonkuhrt
nexus-prisma/example
and suddenly got type errors saying .model
and .crud
did not exist. It had been working a day before. I re-ran yarn to refresh deps, no effect, I opened node_modules/nexus
and navigated to the src/definitionBlock.ts
file (where the ... extends NexusGenCustomOutputProperties ...
magic happens, and then the .crud
and .models
started type checking
CC @weakky @tgriesser after a year at this, what’s your take on this area?koufatzis
09/05/2019, 7:14 AMType 'Promise<string | undefined>' is not assignable to type 'MaybePromise<string>'.
in my resolvers. Is there any solution for that?tafelito
09/05/2019, 2:26 PMtafelito
09/05/2019, 2:28 PMexport const CategoryConnection = prismaObjectType({
name: "CategoryConnection",
definition(t) {
t.prismaFields({ filter: ["aggregate"] });
t.field("aggregate", {
type: "AggregateCategory",
resolve(root, args, { prisma }, info) {
// args is empty here
return {
// @ts-ignore
...root.aggregate,
};
},
});
},
});
Martí Crespí
09/10/2019, 10:24 AMbrikou
09/17/2019, 7:45 AMJosef Henryson
09/17/2019, 8:04 AMapi/prisma/nexus-prisma/nexus-prisma.ts:2580:54 - error TS2694: Namespace '"/Users/.../prisma-client/index"' has no exported member 'VisibleDocuments'.
2580 ) => Promise<prisma.VisibleDocuments[]> | prisma.VisibleDocuments[]
I look in prisma-client/index.ts and I see this:
export const models: Model[] = [
...
{
name: "VisibleDocuments",
embedded: false
},
Any ideas why this happen? I’m quite new to TS and most of my code is JS, just the generated prisma & nexus is TS.Josef Henryson
09/17/2019, 11:06 AMJosef Henryson
09/17/2019, 1:27 PMJosef Henryson
09/19/2019, 11:36 AMJosef Henryson
09/19/2019, 1:38 PMJosef Henryson
09/20/2019, 3:45 PMjasonkuhrt
Josef Henryson
09/24/2019, 7:03 AMconst Shelf = prismaObjectType({
name: 'Shelf',
definition: t => {
t.prismaFields(['*'])
t.field('hasBooks', {
type: 'Boolean',
resolve: async (root, args, ctx) => {
return await ctx.prisma.booksConnection({ where: { shelf: { id: root.id }}})
.aggregate()
.count() > 0
}
})
}
})
jasonkuhrt
Josef Henryson
09/25/2019, 1:36 PMJosef Henryson
10/02/2019, 1:41 PMlucid_frog
10/06/2019, 4:18 PMnexus-prisma
package, I’m following the get Started tutorial (graphql api part) and this line doesn’t seem to be working:
import { makePrismaSchema, prismaObjectType } from 'nexus-prisma'
I’ve also been looking at the nexus-prisma doc and these functions are being used however, when I do a full search on the repo, they are nowhere to be found, any idea?Sullivan Senechal
11/01/2019, 8:17 PMJarvis Prestidge
11/02/2019, 7:09 PMt.crud.createOneUser({ alias: "signupUser" });
I've scanned the issues section and there a couple of issues that don't provide an answer (https://github.com/prisma-labs/nexus/issues/177 + https://github.com/prisma-labs/nexus/issues/64).Jarvis Prestidge
11/02/2019, 7:16 PMJarvis Prestidge
11/04/2019, 2:51 PMside note: is this the right place to ask these questions?
David Blass
11/05/2019, 5:23 PMAndrew O.
11/14/2019, 1:28 AMSlackbot
11/26/2019, 5:29 PMDarryl
11/28/2019, 9:53 AMt.prismaFields([
"categories",
"ingredients",
])
Now, though, it looks like I should be able to just use the following:
t.crud.categories()
t.crud.ingredients()
That said, if I do that I get the following:
Missing type Category, did you forget to import a type to the root query?
So, I define Category
in /types
(Like User
and Post
in the example). I get that this way, I can be explicit in what I want to expose but do I really have to manually create this? I have quite a few models and some of them are more complex with relations to others, containing Enums, etc. Do I need to manually set all of this up or am I missing something? I hope it's the latter. 🙂