以下代码用于突变
field :companyUpdate, Types::CompanyType do
argument :id, !types.ID
argument :file, Types::FileType
resolve -> (obj, args, ctx) {
company = ::Network::Company.find(args[:id])
company.update!(logo: args[:file])
company
}
end
和 file_type.rb 是
Types::FileType = GraphQL::ScalarType.define do
name 'File'
description 'action_dispatch_uploaded_file'
coerce_input ->(action_dispatch_uploaded_file, ctx) {
action_dispatch_uploaded_file
}
end
它不工作。apollo 客户端正在使用 apollo-upload-client 上传文件,但由于文件为空,它会出错。有什么解决办法?