Stef
06/14/2019, 12:16 PMTaylor
06/14/2019, 2:09 PMTaylor
06/14/2019, 2:09 PMJose Garcia
06/14/2019, 2:13 PMtype User @db(name: "user") {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
firstCreatedAt: DateTime
lastSignedInAt: DateTime
lastDailyCheckin: DateTime
password: String
passwordHash: String
salt: String
name: String
email: String @unique
reports: [Report!]!
}
type Report @db(name: "report") {
id: ID! @id
status: REPORT_STATUS! @default(value: PAID)
saleAmount: Float!
commission: Float!
date: DateTime!
user: User! @relation(link: INLINE)
affLink: String!
affiliate: Affiliate @relation(link: INLINE)
}
But when I try to query reports from a user type:
query {
user(where:{id: "cjwsa0fhe01ll0933ekxbihre"}){
id
name
email
reports {
id
}
}
}
And I get this:
Cannot query field \"reports\" on type \"User\".
How could I make this query possible?James Heywood
06/14/2019, 3:38 PMJames Heywood
06/14/2019, 3:38 PMJames Heywood
06/14/2019, 3:39 PMprisma deploy
- for example so I can automate deployment to local, staging and production prisma servers via my CI/CD pipeline?James Heywood
06/14/2019, 3:39 PMJames Heywood
06/14/2019, 3:40 PMGio Gunn
06/14/2019, 4:25 PMJose Garcia
06/14/2019, 5:30 PMdocker-compose
runs the container but you can't make a request to it?Matt Abrams
06/14/2019, 6:29 PMH
06/14/2019, 10:53 PMKianoosh
06/15/2019, 8:24 AMexpress
and prisma
to build a REST API and i have a problem with reading relations with prisma
, Say for instance we have two type as the official example has:
type User {
id: ID! @id
email: String! @unique
name: String
posts: [Post!]!
}
type Post {
id: ID! @id
published: Boolean! @default(value: false)
title: String!
content: String
author: User!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
And one of my endpoints:
<http://app.post|app.post>(`/post`, async (req, res) => {
const { title, content, authorEmail } = req.body
const result = await prisma.createPost({
title: title,
content: content,
author: { connect: { email: authorEmail } },
})
res.json(result)
})
Now what i expect from the response is to have the author id or something arbitrary about it, The respose is like:
{
"updatedAt": "2019-06-15T08:10:29.853Z",
"published": false,
"id": "cjwx8qxjx002p0880y8tijtze",
"createdAt": "2019-06-15T08:10:29.853Z",
"content": "test",
"title": "test"
}
How could i have author id or email alongside of the response ?darren
06/15/2019, 10:46 AMMali
06/16/2019, 7:23 AMdatamodel
recursive files path, instead of entering the .prisma
file under models
folder every time I create a new one. Can we set it like this datamodel: ./models/*.prisma
or a similar one?gem
06/16/2019, 11:24 AMgem
06/16/2019, 11:25 AMTaylor
06/16/2019, 12:44 PMTaylor
06/16/2019, 12:44 PMTaylor
06/16/2019, 12:45 PMgem
06/17/2019, 3:21 AMgem
06/17/2019, 3:51 AMMontana Flynn
06/17/2019, 5:57 AMMontana Flynn
06/17/2019, 5:57 AMMontana Flynn
06/17/2019, 5:57 AMprisma deploy
I get these errors:Montana Flynn
06/17/2019, 5:57 AMOp
✖ One field of the type `Op` must be marked as the id field with the `@id` directive.
Subscription
✖ The type `Subscription` has is using a reserved type name. Please rename it.
Montana Flynn
06/17/2019, 5:58 AMMontana Flynn
06/17/2019, 5:58 AMMontana Flynn
06/17/2019, 5:58 AMDeployment canceled. Please fix the above errors to continue deploying.
Read more about deployment errors here: <https://bit.ly/prisma-force-flag>