Skip to content
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

feat: migrate away from prisma-nexus-plugin. #137

Merged
merged 10 commits into from
May 11, 2021

Conversation

cball
Copy link
Member

@cball cball commented May 11, 2021

This moves to plain Nexus. As a result the graphql modules will take a little more code to wire up, but its less "magical". I've replicated the sorting, ordering, and naming syntax that the plugin used to provide in order to ensure consistency.

The Prisma team is also re-writing this plugin, so I'd rather not depend on it. See graphql-nexus/nexus-plugin-prisma#1039 for more info.

Changes

  • updates generators
  • removes nexus-prisma-plugin dependency
  • updates package.json scripts
  • adds graphql shared module
  • updates user graphql module
  • renames and updates seed file

Screenshots

n/a

Checklist

  • Requires dependency update?
  • Generating a new app works

Fixes #136

@cball cball requested a review from mthomps4 May 11, 2021 12:57
Copy link
Contributor

@mthomps4 mthomps4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question on Auth for knowledge sake.
Otherwise looks good.

I'd go ahead and strip v10 in Tests and bump the min required to v12 in this one as well.
Fixed via #135

// List <%= plural %> Query
t.list.field('<%= plural.toLowerCase() %>', {
type: '<%= camelized %>',
authorize: () => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this defaulting to no authorization needed? or opposite?
If so, should we default a user context as most should/will be?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good call. I'll update. More than anything we just want to ensure to lock down by default with the generators. This is perhaps too locked down 😄

Comment on lines +10 to +25
export const StringFilter = inputObjectType({
name: 'StringFilter',
description: 'A way to filter string fields. Meant to pass to prisma where clause',
definition(t) {
t.string('contains');
t.string('endsWith');
t.string('equals');
t.string('gt');
t.string('gte');
t.list.nonNull.string('in');
t.string('lt');
t.string('lte');
t.list.nonNull.string('notIn');
t.string('startsWith');
},
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

t.nonNull.id('id');
t.nonNull.date('createdAt');
t.nonNull.date('updatedAt');
t.nonNull.list.nonNull.field('roles', { type: 'Role' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does nonNull catch empty arrays?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be equivalent to [Role!]! which doesn't allow role to return null or any items within the array to be null. It should allow an empty array though.

it("copies prisma/env with the correct contents", async () => {
const target = path.join(targetFolder, "prisma", ".env");
it("copies env with the correct contents", async () => {
const target = path.join(targetFolder, ".env");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

* updates generators
* removes nexus-prisma-plugin dependency
* updates package.json scripts
* adds graphql shared module
* updates user graphql module
* renames and updates seed file
@cball cball force-pushed the 136-remove-nexus-prisma-plugin branch from 36b57ed to 9089c05 Compare May 11, 2021 13:15
@cball cball merged commit 093e8c4 into canary May 11, 2021
@cball cball deleted the 136-remove-nexus-prisma-plugin branch May 11, 2021 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate away from nexus prisma plugin
2 participants