stephen.pearl
01/25/2021, 9:08 PMsven
01/26/2021, 12:47 PMJohn Smeeth
01/27/2021, 7:22 AMnexus-plugin-prisma: 0.28.0
2.14
in my query i have definition with args
args: {
lowPrice: floatArg(),
highPrice: floatArg(),
},
And in the resolver i got error in typechecking
Type 'number | null | undefined' is not assignable to type 'number | undefined'.
Type 'null' is not assignable to type 'number | undefined'.ts(2322)
What wrong with me? Please give me an advice, many thankJohn Smeeth
01/27/2021, 7:24 AMAND: [
{ price: { gte: lowPrice } },
{ price: { lte: highPrice } },
],
stephen.pearl
01/27/2021, 5:31 PMscalars: {
DateTime: DateTimeResolver,
Json: new GraphQLScalarType({
...JSONObjectResolver,
name: 'Json',
description:
'The `JSON` scalar type represents JSON objects as specified by [ECMA-404](<http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).>'
})
}
I am following the README here (https://github.com/graphql-nexus/nexus/blob/b327841a6380f80043705b20348fce21b0bf50[…]ontent/040-adoption-guides/030-neuxs-framework-prisma-users.mdx) and it seems like a step is missing.Daniel Mahon
01/27/2021, 7:49 PMDaniel Mahon
01/27/2021, 7:50 PMexport const ToolStatePayload = objectType({
name: 'ToolStatePayload',
definition: (t) => {
t.model('ToolState').id();
t.model('ToolState').createdAt();
t.model('ToolState').statusCode();
t.list.toolStateLance('lances');
},
});
Daniel Mahon
01/27/2021, 7:51 PMexport const toolStates = extendType({
type: 'Query',
definition: (t) => {
t.field('getPostJobData', {
type: list('ToolStatePayload'),
args: {
ids: nonNull(list(nonNull(idArg()))),
},
resolve: async (_parent, { ids }, ctx: Context) => {
// HERE /////////////////////////////////////
let states: NexusObjectTypeDef<'ToolStatePayload'>[] = [];
...
Daniel Mahon
01/27/2021, 7:52 PMDaniel Mahon
01/27/2021, 9:46 PMlet states: NexusGenObjects['ToolStatePayload'][] = [];
Jonathan
01/27/2021, 10:06 PMSpiros - Product at Prisma
Bruno Borges
01/31/2021, 2:59 PMMichael
02/01/2021, 12:51 PMmutation updateMilestones($input: [MilestoneInput!]) {
updateMilestones(input: $input) {
id
orderIndex
}
}
``;`
export const milestoneInput = inputObjectType({
name: "MilestoneInput",
definition(t) {
t.string("id");
<http://t.int|t.int>("orderIndex");
},
});
So when I pass
mutation {
updateMilestones(input: [{id: "123", orderIndex:1}, { id: "42", orderIndex: 2}]) {
id
}
}
I get this error: “Expected value of type \“MilestoneInput\“, found [{id: \“123\“, orderIndex: 1}, {id: \“42\“, orderIndex: 2}].“,
Any advice? I coulnd’t find a solution yet. 🤔Brandon Wang
02/01/2021, 10:35 PMDaniell
02/01/2021, 10:54 PMif you have any questions about removing the the nexus-plugin-prisma from your application
? I am not sure what to do at this pointStephen Flannery
02/02/2021, 3:53 AMservers Server[]
and Servers have
users User[]
and I would like users to be able to join servers. Any help is appreciated. Thanks.Manthan Mallikarjun
02/04/2021, 8:43 AMProperty 'date' does not exist on type 'Pick<OutputDefinitionBlock<"DataFeedItem">, "string" | "boolean" | "id" | "typeName" | "list" | "int" | "float" | "field">'.
? I followed this guide https://nexusjs.org/docs/adoption-guides/nexus-framework-users#bundled-scalars and t.nullable.date
even pops up with vscode autocomplete so im pretty sure I did it right but typescript complainsTimo
02/04/2021, 9:21 AMt.model.meta
within an post
object
Post:findUnique:{"where":{"id":"sktwi7ggkkmcytvo1fdac53cef1a6129"},"select":{"meta":{}}}'
instead of
Post:findUnique:{"where":{"id":"sktwi7ggkkmcytvo1fdac53cef1a6129"},"include":{"meta":true}}
Timo
02/04/2021, 9:22 AMMeta:findUnique:{"where":{"postId":"sktwi7ggkkmcytvo1fdac53cef1a6129"}}
Timo
02/04/2021, 9:23 AMmeta
object as the post
with id sktwi7ggkkmcytvo1fdac53cef1a6129
slinden
02/04/2021, 12:34 PMprisma2
, nexus
and nexus-plugin-prisma
. The problem happens in a simple query that gets data from multiple tables. GraphQL objects:
export const Conference = objectType({
name: "Conference",
definition(t) {
t.model.id();
t.model.divisions();
},
});
export const Division = objectType({
name: "Division",
definition(t) {
t.model.id();
t.model.conferences();
},
});
export const DivisionConference = objectType({
name: "DivisionConference",
definition(t) {
t.model.id();
t.model.season();
t.model.conference();
t.model.conferenceId();
t.model.division();
t.model.divisionId();
},
});
I have setup divisions
query using t.crud
like this:
export const DivisionQuery = extendType({
type: "Query",
definition(t) {
t.crud.divisions();
},
});
And my GraphQL query is like this:
query {
divisions {
id
conferences {
season
conference {
id
}
}
}
}
I have currently 8 divisions in the database out of which 4 are connected to 1 conference each via that DivisionConference
table. These are the logged queries: https://pastebin.com/HkX8c4jc
I mean, that is a simple query. I am surely doing something wrong, but don't know what :)nikolasburk
nexus-plugin-prisma
from your GraphQL Nexus app. It covers how to use Nexus' native t.field()
API instead of the plugin's t.model()
to expose the fields of your Prisma models to GraphQL. We'll add the second part covering the migration process for t.crud()
soon.
I've also elaborated a bit on @Spiros - Product at Prisma's initial message in the GitHub issue about the future of the nexus-plugin-prisma
to explain a bit more how we've gotten into this situation. We know that the recent and sudden changes have caused a lot of frustration among a lot of you and want to apologize for the poor communication about the state of the plugin over the past year!
Please feel free to reach out to me personally if you have any questions about how to move forward with your project or if there's anything else that I can help you with! 🙏mikkelsl
02/08/2021, 9:04 PMslinden
02/09/2021, 10:22 AMnexus-plugin-prisma
=> nexus
migration, but I am encountering a problem with all relations to one particular table and can't figure out whats the problem. Here is some code:
model Player {
id String @id @default(cuid())
playerIdApi Int @unique
firstName String
lastName String
...
...
teams PlayerTeam[]
skaterBoxscores SkaterBoxscore[] @relation("PlayerSkaterBoxscores")
goalieBoxscores GoalieBoxscore[] @relation("PlayerGoalieBoxscores")
highlightMetaGoal HighlightMeta[] @relation("PlayerHighlightMetaGoal")
highlightMetaAssist1 HighlightMeta[] @relation("PlayerHighlightMetaAssist1")
highlightMetaAssist2 HighlightMeta[] @relation("PlayerHighlightMetaAssist2")
highlightMetaGoalie HighlightMeta[] @relation("PlayerHighlightMetaGoalie")
favoritedBy User[] @relation("UserFavoritePlayers")
}
export const User = objectType({
name: "User",
definition(t) {
t.nonNull.string("id");
...
...
t.nonNull.list.field("favoritePlayers", {
type: "Player",
resolve: async (parent, _, ctx) => {
return await ctx.prisma.user
.findUnique({ where: { id: parent.id } })
.favoritePlayers();
},
});
},
});
I have defined several relation like this, but I get an error every time I am creating a relation to type: "Player"
in all objectTypes
. In the User
type the error is this:
Type '(parent: { createdAt: any; email: string; id: string; isVerified: boolean; role: "ADMIN" | "MODERATOR" | "USER"; updatedAt: any; username: string; usernameLower: string; }, _: {}, ctx: Context) => Promise<...>' is not assignable to type 'FieldResolver<"User", "favoritePlayers">'.
Type 'Promise<Player[]>' is not assignable to type '({ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; ... 12 more ...; weight: number; } | null)[] | PromiseLike<...> | MaybePromise<...>[] | PromiseLike<...>'.
Type 'Promise<Player[]>' is not assignable to type 'PromiseLike<MaybePromise<{ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; ... 12 more ...; weight: number; } | null>[]>'.
Types of property 'then' are incompatible.
Type '<TResult1 = Player[], TResult2 = never>(onfulfilled?: ((value: Player[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = MaybePromise<{ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; ... 12 more ...; weight: number; } | null>[], TResult2 = never>(onfulfilled?: ((value: MaybePromise<...>[...'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'Player[]' is not assignable to type 'MaybePromise<{ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; ... 12 more ...; weight: number; } | null>[]'.
Type 'Player' is not assignable to type 'MaybePromise<{ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; ... 12 more ...; weight: number; } | null>'.
Type 'Player' is not assignable to type '{ active: string; alternateCaptain: boolean; birthCity: string; birthCountry: string; birthDate: any; birthStateProvince?: string | null | undefined; captain: boolean; firstName: string; height: number; ... 11 more ...; weight: number; }'.
Awey
02/09/2021, 7:49 PM"message": "Cannot read property 'post' of undefined",
on this query
{
posts {
id
createdAt
title
author {
name
}
}
}
The files are in /src
/pages/api/graphql.ts
and /pages/_app.tsx
slinden
02/10/2021, 4:49 PMinterfaceType
. I mean, if I create an interface that is used in multiple `objectType`s shouldnt I just define the type in the objectType
?slinden
02/12/2021, 12:48 PM<http://t.nonNull.int|t.nonNull.int>("gamePks")
. I would like to modify it before sending it to the client. I tried this:
t.nonNull.list.nonNull.field("gamePks", {
type: "String",
resolve: (parent) => {
return parent.gamePks.split(", ");
},
});
This works, but I get a type error on parent.gamePks
. The error is that it doesnt exist in the parent.
The object definition is like this:
export const BestSkater = objectType({
name: "BestSkater",
isTypeOf() {
return true;
},
definition(t) {
t.implements("BestPlayer");
<http://t.nonNull.int|t.nonNull.int>("points");
.
.
.
t.nonNull.list.nonNull.field("gamePks", {
type: "String",
resolve: (parent) => {
return parent.gamePks.split(", ");
},
});
},
});
Meiri Anto
02/12/2021, 11:45 PMt.model
is giving me errors because the root
is type of the field which is string
not the parent type IntakeApplication
t.model.name({
authorize: (_parent, _args, ctx) => isAdmin(ctx),
resolve: async (parent, args, ctx, info, originalResolve) => {
const res = await originalResolve(parent, args, ctx, info);
return res;
},
});
error I'm getting with parameter parent
in line 4:
Argument of type 'string' is not assignable to parameter of type 'IntakeApplication'.ts(2345)
Julien Goux
02/15/2021, 1:45 PM