-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load nested mutations and queries in
blitz console
(#3031)
(patch)
- Loading branch information
1 parent
1d6021d
commit 9cff223
Showing
3 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters