kitze
10/20/2018, 8:30 AMprisma generate
Generating schema 27ms
▸ Syntax Error: Expected Name, found }
Anders
10/20/2018, 8:51 AMFi1osof
10/20/2018, 10:52 AMshoggs
10/20/2018, 11:53 AMNitin Hayaran
10/20/2018, 7:00 PMNitin Hayaran
10/20/2018, 7:05 PMasync signup(parent, args, ctx, info) {
// lowercase their email
args.email = args.email.toLowerCase();
// hash their password
const password = await bcrypt.hash(args.password, 10);
const user = await ctx.db.mutation.createUser(
{
data: {
...args,
password
}
},
info
);
return {
user, // is always undefined
token: utils.getToken(user)
};
}
Nitin Hayaran
10/20/2018, 7:06 PMtype SignupResponse {
token: String!
user: User!
}
type Mutation {
signup(name: String!, email: String!, password: String!): SignupResponse!
}
However it works if i stop returning custom return type and start returning User
Nitin Hayaran
10/20/2018, 7:06 PMMartin Hunt
10/21/2018, 4:04 PMmutation {
createListItem(title:"this is a test of a new item") {
id
title
}
}
Returns one item. But then, when running:
query {
listItems(first:4 skip:0){
id
title
}
}
I see two items returned with the same title and different ID's. My mutation is about as simple as it gets
createListItem(parent, args, context, info) {
return context.prisma.createListItem({ title: filter.clean(args.title) })
}
so I'm just not sure what could be going wrong here. Again, it's working fine locally and the only real difference between the two is the NODE_ENV.
Both the local and deployed versions are connecting to the same Prisma demo database. If I go directly to the playground of the prisma database I don't get the same issue.
Any help figuring out where to start would be appreciated beyond beliefducdev
10/21/2018, 4:45 PMyolen
10/21/2018, 9:12 PMNick
10/22/2018, 7:00 AMNick
10/22/2018, 7:01 AMNick
10/22/2018, 7:02 AMserver.start({
debug: true,
cacheControl: {
defaultMaxAge: 5
},
port: process.env.PORT,
playground: process.env.PLAYGROUND
},
() => log(`🚀 Server is running on localhost:${process.env.PORT}`)
but when i send request to server i see what no caching in this momentNick
10/22/2018, 7:05 AMtype Address @cacheControl(maxAge: 86400) {...fields...}
but anyway request will directed to dbyolen
10/22/2018, 8:02 AMconst resolvers = {
Query: {
laws(parent, args, context, info) {
return context.prisma.query.laws(
{ where: args.where, skip: args.skip, first: args.first, orderBy: args.orderBy },
info,
)
},
},
}
, but i struggle to get it working in typescript : export const Query: QueryResolvers.Type = {
...QueryResolvers.defaultResolvers,
laws: (parent, args, ctx) => ctx.db.laws({where: args.where})
}
throws the error Property 'where' does not exist on type '{}'.
I have then tried to do something like interface LawsArgs{
where?: lawsArgs.LawWhereInput;
orderBy?: lawsArgs.LawOrderByInput;
skip?: <http://lawsArgs.Int|lawsArgs.Int>;
after?: String;
before?: String;
first?: <http://lawsArgs.Int|lawsArgs.Int>;
last?: <http://lawsArgs.Int|lawsArgs.Int>;
}
export const Query: QueryResolvers.Type = {
...QueryResolvers.defaultResolvers,
laws: (parent, args:LawsArgs, ctx) => ctx.db.laws({where: args.where})
}
but still no luck.. (I am a typescript newbie :-()aroman
10/22/2018, 2:02 PMtype User {
id: ID! @unique
email: String @unique
firstName: String!
middleName: String
lastName: String!
password: String!
role: Role!
orders: [Order!]!
}
enum Role {
Admin
Owner
Physician
Patient
Provider
Disabled
}
when I createUser()
I've manually added the Role, and I have tried to also put it as a @default
directive, however, when I call back or fetch on user the Role value is not there thus interfering with my permissions etc. Would any one able to shed some light? I am using prisma 1.17Sach97
10/22/2018, 2:43 PMtype Client struct {
Endpoint string
Secret string
Session *Session
GQLClient *graphql.Client
}
type Session struct {
ws *websocket.Conn
errChan chan error
}
Or fork both prisma-client-lib for the channel part and machinebox/graphql for the websocket connection part ?lawjolla
10/22/2018, 5:22 PMbrentsoles
10/22/2018, 5:44 PMNuno
10/22/2018, 5:55 PMNuno
10/22/2018, 5:57 PMNuno
10/22/2018, 5:59 PMwontwon
10/22/2018, 7:05 PMTed
10/22/2018, 8:37 PMtim
10/23/2018, 1:07 AMtype Song @model {
id: ID! @isUnique
name: String!
}
type ConcertSong @model {
id: ID! @isUnique
song: Song @relation(name: "Songs")
concerts: [ConcertSong!]! @relation(name: "ConcertSongs")
}
type Concert @model {
id: ID! @isUnique
venue: Venue! @relation(name: "ConcertVenue")
start: DateTime!
setlist: [ConcertSong!]! @relation(name: "ConcertSongs")
opener: Artist
}
data entry will be adding a bunch of songs, then a bunch of concerts, then a bunch of ConcertSong's... is there a way to add ConcertSongs without having to find the id (something more human readable).
also, is there a better way to do a bunch of data entry like this than mutations? there will likely be hundreds of concerts and songs. Thanks!Fran Dios
10/23/2018, 7:45 AMconnect
inside updateManyPosts
. It returns the correct “count” of modified entities but nothing has changed in the DB 🤔
Edit: seems that it’s already reported https://github.com/prisma/prisma/issues/2010nuno
10/23/2018, 9:35 AMhinsxd
10/23/2018, 12:30 PMhinsxd
10/23/2018, 12:31 PM