| 1 | import { createParamDecorator, type ExecutionContext } from '@nestjs/common'; |
| 2 | import { GqlExecutionContext } |
| 3 | |
| 4 | import type { GithubRequest, |
| 5 | |
| 6 | export const Viewer = |
| 7 | (_: unknown |
| 8 | const req = |
| 9 | context.getType<string |
| 10 | ? GqlExecutionContext.create( |
| 11 | req: GithubRequest |
| 12 | }>().req |
| 13 | : context.switchToHttp() |
| 14 | return req.githubViewer |
| 15 | }, |
| 16 | ); |