cRUSHER
09/22/2018, 1:19 PMcRUSHER
09/22/2018, 1:25 PMAnders
09/22/2018, 3:26 PMAnders
09/22/2018, 3:26 PMpost-deploy:
spawnSync graphql ENOENT
Running graphql get-schema -p prisma ✖
Anders
09/22/2018, 3:27 PMendpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.graphql
# secret: ${env:PRISMA_SECRET}
hooks:
post-deploy:
- graphql get-schema -p prisma
Anders
09/22/2018, 3:27 PMGustavo Britto
09/22/2018, 6:47 PMGustavo Britto
09/22/2018, 6:47 PMSh4reef
09/22/2018, 10:22 PMSh4reef
09/22/2018, 10:22 PMitaied
09/23/2018, 7:11 AMsecret
?
As I see it, I want to disable the access to the general prisma service (the one with all the data access),
and allow access only to my filtered service.
If I set the secret and set it (or pass it) to the client, anyone can use it later,
it doesn't solve any authentication issueEntrepreneur3
09/23/2018, 1:29 PMhinsxd
09/23/2018, 6:52 PMstudent
or teacher
. Student can only createQuestion
and teachers can only answerQuestion
.
As I come from the REST world, when I first constructed the data model, I started with
type Question {
student: User! @relation(name:"ask")
teacher: User @relation(name:"answer")
}
type User {
askedQuestions: [Question!]! @relation(name:"ask")
answeredQuestions: [Question!]! @relation(name:"answer")
role: Role! // enum Role { New Student Teacher }
}
Quickly I found that a lot of post-query logic has to be done (on choosing which variable to process on getUser
for example) on the client side, which should not happen. I thought of two roles sharing the same variable questions
because their functions are exclusive, but this would be SO confusing for further development. Then I learnt implements
feature of GraphQL and tried the following in `datamodel.graphql`:
type Question {
student: Student!
teacher: Teacher
}
interface User { role: Role! }
type Student implements User { askedQuestions: [Question!]! }
type Teacher implements User { answeredQuestions: [Question!]! }
I omitted the repeated fields for simplicity. I learnt this from https://graphql.org/learn/schema/ , and that is actually what I want: role-based fields. Then I found out that prisma will flatten all implements
and give me different types. I started to realize that I should put this in schema.graphql
rather than datamodel.graphql
. But then, how can I construct my datamodel.graphql
? Should I first make a User
type like the first paragraph of code, then implement a schema like the second one, followed by resolvers to fetch from ctx.db.Users
?
Please let me know if I am on the right track! Thanks so much!DBabel
09/23/2018, 9:11 PMjjaybrown98
09/24/2018, 12:50 PMhez
09/24/2018, 1:42 PMJulien Goux
09/24/2018, 2:15 PMJulien Goux
09/24/2018, 2:15 PMJulien Goux
09/24/2018, 2:18 PMjdoyle112
09/24/2018, 3:20 PMAndres Montoya
09/24/2018, 3:46 PMgo4cas
09/24/2018, 4:48 PMjdoyle112
09/24/2018, 4:51 PMxiaoqf10
09/25/2018, 4:38 AMxiaoqf10
09/25/2018, 4:38 AMxiaoqf10
09/25/2018, 4:38 AMxiaoqf10
09/25/2018, 5:45 AMLucas Munhoz
09/25/2018, 7:36 AMsilkyland
09/25/2018, 9:20 AMLotafak
09/25/2018, 12:14 PMFiles are secured using a unique and unguessable secret. You can protect this secret by using the read permissions on the File type as with any other type. For example, you can restrict access to a file’s secret to authenticated users.
File downloads however are currently not governed by permissions on the File type. As such, everyone with a file’s secret and the project id can download a file. Please reach out in the Forum or Slack if you have any questions about this.So, basically I need to restrict download itself. As it says, I’m reaching the slack to ask for a possible solutions to this