adubs
07/13/2019, 1:38 AMHabbey
07/13/2019, 10:38 AMericsonluciano
07/13/2019, 5:06 PMUser
and Promoter
? or should i add a role: User
then add enum with USER, PROMOTER? what is a good? since i need a condition that user can't mutation in type of Events
Wagner D'Amaral
07/14/2019, 12:49 AMUser
resolver is this
import getUserId from '../utils/getUserId'
const User = {
email: {
fragment: 'fragment userId on User { id }',
resolve(parent, args, {
request
}, info) {
const userId = getUserId(request, false)
console.log(userId) //here I can see the id of the logged user
console.log(parent.id) // here I see UNDEFINED
if (userId && userId === parent.id) {
return parent.email
}
return null
}
}
}
export {
User as
default
}
My `server.js`:
import {
GraphQLServer,
PubSub
} from 'graphql-yoga'
import {
resolvers,
fragmentReplacements
} from './resolvers/index'
import prisma from './prisma'
const pubsub = new PubSub()
const server = new GraphQLServer({
typeDefs: './src/schema.graphql',
resolvers,
context(request) {
return {
pubsub,
prisma,
request
}
},
fragmentReplacements
})
console.log(fragmentReplacements) //Here I can see that the application is picking up the fragments
export {
server as
default
}
Finally, my User
query:
users(parent, args, {
prisma
}, info) {
const opArgs = {
first: args.first,
skip: args.skip,
after: args.after,
orderBy: args.orderBy
}
if (args.query) {
opArgs.where = {
OR: [{
name_contains: args.query
}]
}
}
return prisma.query.users(opArgs, info)
},
I'm using
"graphql": "^14.3.1",
"graphql-cli": "^3.0.11",
"graphql-yoga": "^1.17.4",
and prisma 1.34
Does anybody have any clue on what could be the issue?Imran
07/14/2019, 8:50 AM/users
route I will get data like below
[
{
id: 'alksdf',
email: '<mailto:email@email.com|email@email.com>',
name: 'my name',
posts: [
{
id: "asldfasdfkl",
title: 'title',
content: 'content here'
}
]
}
]
Actually I mean the nested query here. All the posts an user have will be inside the user Object. How can I do this?
I can get this with graphql, but I want it with REST api. I am fairly new in Prisma and I don't get any good docs on REST api.
Thank youjamiehalvorson
07/14/2019, 10:29 AM1.26
to 1.34
and after running prisma introspect
and updating the datamodel I’m getting the following error:
▸ The Migration failed and has not been performed. This is very
▸ likely not a transient issue.
▸ java.sql.SQLSyntaxErrorException: (conn=183) Table
▸ '_ProgrammeClassToProgrammeWeek' already exists
Spectrum link: https://spectrum.chat/prisma/general/upgrading-to-1-34-1-the-migration-failed-and-has-not-been-performed~c713d1c8-916e-429c-af84-a44c65f8cf5e
Any pointers would be greatly appreciated, thanks!fandy
07/14/2019, 5:33 PMID
https://www.prisma.io/docs/1.34/datamodel-and-migrations/datamodel-POSTGRES-knum/#fieldsfandy
07/14/2019, 5:33 PMfandy
07/14/2019, 5:34 PMtype AuthResponse {
token: String
}
fandy
07/14/2019, 5:34 PMErrors:
AuthResponse
✖ One field of the type `AuthResponse` must be marked as the id field with the `@id` directive.
Ragupathy Jayaraj
07/15/2019, 7:09 AMRagupathy Jayaraj
07/15/2019, 7:10 AMSyed Ali Zaidi
07/15/2019, 8:21 AMgem
07/15/2019, 8:59 AMrooneyK
07/15/2019, 1:01 PMgraphql
query{
albums{
files{
id
}
}
}
I would like to rewrite it in the resolver with some arguments added to the nested field files
, resulting in something like the following
graphql
query{
albums{
files(where: {archiveAt: null}){
id
}
}
}
I tried using addFragmentToInfo(
info,
'fragment EnsureOnlyArchived on Album { files(where: {archived: null}) }'
)
I tried traversing and modifying the info-object manually, but gave up since it did not feel very clean. Is there something like addFragmentToInfo
that lets me inject variabled into the nested query?cmckinstry
07/15/2019, 1:55 PMmyschema.datamodel
). Is there any way to do this with the current version of prisma?Sam
07/16/2019, 2:13 AMprisma init
.
https://www.prisma.io/blog/heroku-integration-homihof6eifi
How do I push an existing Prisma project to heroku? prisma deploy
generates things locally, which was good. Should update config in prisma.yml
?Darryl
07/16/2019, 3:07 AMSohail Khan
07/16/2019, 4:00 AMChris Wilson
07/16/2019, 9:24 AMChris Wilson
07/16/2019, 9:31 AMChris Wilson
07/16/2019, 9:32 AMAndre Coetzee
07/16/2019, 9:49 AMMichal Svrcek
07/16/2019, 12:42 PMPush to Prometheus Gateway failed with:
2019-07-16T12:37:43.696613+00:00 app[web.1]: com.prisma.akkautil.http.FailedResponseCodeError: Server responded with 502
2019-07-16T12:37:43.696702+00:00 app[web.1]: at com.prisma.akkautil.http.SimpleHttpClient.$anonfun$execute$4(SimpleHttpClient.scala:107)
2019-07-16T12:37:43.696707+00:00 app[web.1]: at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:303)
2019-07-16T12:37:43.696711+00:00 app[web.1]: at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
2019-07-16T12:37:43.696743+00:00 app[web.1]: at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
2019-07-16T12:37:43.696765+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
2019-07-16T12:37:43.696767+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
2019-07-16T12:37:43.696768+00:00 app[web.1]: at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
2019-07-16T12:37:43.696772+00:00 app[web.1]: at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
2019-07-16T12:37:43.696776+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
2019-07-16T12:37:43.696781+00:00 app[web.1]: at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
2019-07-16T12:37:43.696805+00:00 app[web.1]: at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
2019-07-16T12:37:43.696809+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
2019-07-16T12:37:43.696838+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
2019-07-16T12:37:43.696844+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
2019-07-16T12:37:43.696847+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Michal Svrcek
07/16/2019, 12:43 PMPush to Prometheus Gateway failed with:
2019-07-16T12:42:54.806370+00:00 app[web.1]: akka.stream.scaladsl.TcpIdleTimeoutException: TCP idle-timeout encountered on connection to [<http://metrics-eu1.prisma.io:443|metrics-eu1.prisma.io:443>], no bytes passed in the last 30 seconds
Andrew O.
07/16/2019, 6:18 PMAndrew O.
07/16/2019, 6:19 PMfaure
07/16/2019, 9:08 PMQuery.dataConnection.pageInfo.hasPreviousPage
display true
when expected.Erik
07/17/2019, 7:34 AMError: You provided an invalid argument for the where selector on Product. { where: [Object: null prototype] { id: 'cjy2q1q0raucq0b366061xoos' } }
. which to me look awfully wrong. the full query looks like this: query {
product(
where: {id: "cjy2q1q0raucq0b366061xoos"}
) {
id
name
}
}
shouldn't the id argument be directly attached to the arguments object? Im logging the correct argument if I do it like this args.where.id