Skip to content

Commit

Permalink
Load nested mutations and queries in blitz console (#3031)
Browse files Browse the repository at this point in the history
(patch)
  • Loading branch information
skotchpine authored Dec 8, 2021
1 parent 1d6021d commit 9cff223
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions examples/auth/app/queries/users/currentUserQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Ctx} from "blitz"
import db from "db"

export default async function currentUserQuery(_ = null, {session}: Ctx) {
if (!session.userId) return null

const user = await db.user.findFirst({
where: {id: session.userId},
select: {id: true, name: true, email: true, role: true},
})

return user
}
1 change: 1 addition & 0 deletions examples/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dev": "blitz dev",
"build": "blitz build",
"start": "blitz start",
"console": "blitz console",
"studio": "blitz prisma studio",
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
"analyze": "cross-env ANALYZE=true blitz build",
Expand Down
2 changes: 1 addition & 1 deletion nextjs/packages/next/cli/next-console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getBlitzModulePaths() {

const paths = await globby(
[
'app/**/{queries,mutations}/*.{js,ts,tsx}',
'app/**/{queries,mutations}/**/*.{js,ts,tsx}',
'utils/*.{js,ts,tsx}',
'jobs/**/*.{js,ts,tsx}',
'integrations/**/*.{js,ts,tsx}',
Expand Down

0 comments on commit 9cff223

Please sign in to comment.