# frozen_string_literal: true module Mutations class UploadPokemon < Mutations::BaseMutation include ::ReturnsErrors field :pokemon, Types::PokemonType, null: true argument :base64_encoded_pokemon_file, GraphQL::STRING_TYPE, required: true def resolve(base64_encoded_pokemon_file:) # Pass in user and other contexts in the future service = CreatePokemonFromBase64Service.new result = service.execute(base64_encoded_pokemon_file) result[:pokemon] = result[:pokemon]&.first result end end end