-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: refactor graphback to hide unused features #3
fix: refactor graphback to hide unused features #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is really helpful! LGTM, just have some suggestions
|
||
const { typeDefs, resolvers, contextCreator } = buildGraphbackAPI(modelDefs, { | ||
crud: { | ||
create: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create: true, | |
create: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this feature. Nice to see it exposed like this 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. We can enable them on models directly or globally. I felt like in this case global one is needed.
crud: { | ||
create: false, | ||
update: true, | ||
find: true, | ||
findOne: true, | ||
delete: true, | ||
subCreate: false, | ||
subUpdate: false, | ||
subDelete: false | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values default to true, so you can just pass the ones you want to change.
crud: { | |
create: false, | |
update: true, | |
find: true, | |
findOne: true, | |
delete: true, | |
subCreate: false, | |
subUpdate: false, | |
subDelete: false | |
}, | |
crud: { | |
create: false, | |
subCreate: false, | |
subUpdate: false, | |
subDelete: false | |
}, |
version: '3' | ||
|
||
services: | ||
postgres: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a custom Postgres dockerfile we're using. You can copy this configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this is that it provides a pre-seeded DB for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I struggled to run it - credentials would not allow me to log in for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @wtrocki - thank you!
Motivation
Improve server-side application and lock graphback versions to usable ones.
What was done
Use fixed versions of packages (they might break if updated outside the scope so we want to pin them. Renovate is configured to update them together same with github updates
Move graphback specific code out of the index for visibility
Disable graphback subscriptions as they might be confusing for the users (subscriptions will not deliver the changes in the database as one might expect (they will be only delivering changes that happening thru graphql API.
Why this was done
I wanted to avoid misunderstanding about subscriptions and streaming. Our team will do POC on top of this repository to connect junction stream to the subscriptions - this is for our own needs for the moment it is important to disable queries that might confuse potential developers trying the api.
Verification
I struggled to verify this changes because of the connection details for knex. Our templates use .env files. I have added temporary docker-compose file and tried to run it by
but could not. If you can try if that works for you that will be great.