You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: leave.rb
    path of file: ./repos/mashcard/apps/server-monolith/app/graphql/mutations/groups
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Mutations
  module Groups
    class Leave < ::Mutations::BaseMutation
      graphql_name 'GroupLeave'
      argument :domain, String, 'Pod domain', required: true
      argument :user_domain, String, 'User domain', required: true

      def resolve(domain:, user_domain:)
        group = current_user.groups.find { |p| p.username == domain }
 
    
      def resolve(domain:, user_domain:)
        group = current_user.groups.find { |p| p.username == domain }
        return { errors: [I18n.t('settings.errors.invalid_operation_type')] } if group.nil?

        forbidden = group.owner != current_user && user_domain != current_user.domain
        return { errors: [I18n.t('settings.errors.invalid_operation_type')] } if forbidden

        member = group.members.find { |p| p.user.username == user_domain }
        return { errors: [I18n.t('settings.errors.invalid_operation_type')] } if member.nil?

        success = member.destroy
        success ? {} : { errors: errors_on_object(id) }
      end
    end