Use GqlExecutionContext.create(context) to switch from the NestJS ExecutionContext to the GraphQL context. Without this, ctx.switchToHttp() returns undefined in a GraphQL resolver. Build a @CurrentUser() param decorator that reads from GqlExecutionContext to inject the authenticated user directly into resolver arguments.
ctx.switchToHttp() returns undefined in a GraphQL resolver — always use GqlExecutionContext.create(ctx).
GqlExecutionContext.create(ctx).getContext() returns the context object from the GraphQLModule factory.
The req object is available on the context only when forwarded via the context factory in GraphQLModule.forRoot().
@Context() injects the full context object; @Context('req') injects only the req field.
Building a @CurrentUser() decorator avoids repeating GqlExecutionContext logic in every resolver.