A resolver is a class decorated with @Resolver() that maps GraphQL operations to service calls. Each method decorated with @Query(), @Mutation(), or @Subscription() maps to a field in the schema's root types. The arrow function return type in @Query() is required because TypeScript metadata cannot represent GraphQL array types.
@Resolver(() => User) — tells NestJS this class handles field resolution for the User type.
@Query(() => ReturnType) — the arrow function is required; TypeScript metadata cannot represent GraphQL arrays.
name option in @Query() — overrides the default field name; otherwise the method name is used.
nullable: true — marks the field as returning User | null in the generated schema.
Resolvers are registered in the module's providers array like any other NestJS provider.