Class: Ecoportal::API::GraphQL::Mutation::Image::Upload

Inherits:
Logic::Mutation
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/mutation/image/upload.rb

Overview

Registers an object already uploaded to S3 as a TempImage -- the upload-staging model behind Image Gallery (and other, non-gallery) image uploads.

★ Sibling to Mutation::FileContainer::Upload, NOT a variant of it: an Image Gallery image is explicitly NOT a FileContainer. Verified against the live ecoPortal server source (read-only, /tmp/work/ecoPortal):

* `app/graphql/mutations/images/upload.rb:1-23` -- the mutation builds an
`Enzyme::ImageReference::TempImage`, not `uploadFile`/`FileContainer`.
* `app/graphql/types/mutation_type.rb:224` -- schema field `uploadImage`
(`field :upload_image, mutation: Mutations::Images::Upload`).
* `app/graphql/types/enums/files/image_upload_type_enum.rb` -- `type:` is a
live enum (`image_gallery`, `policy_group`, `theme`, `user`, `organization`,
`brand`); `"image_gallery"` is the one `Base::Page::DataField::ImageGallery`
consumes.

The SIGNATURE and S3-POST steps upstream of this call are IDENTICAL to the uploadFile flow (same fileUploadSignature, same multipart POST) -- see FileUpload::Client#upload_image, which shares its presign+store step with #upload and only diverges here, at registration.

Verified against the live schema:

uploadImage(input: ImagesUploadInput!) -> ImagesUploadPayload
{ clientMutationId errors item: TempImage }
ImagesUploadInput { clientMutationId key type id import }

Instance Method Summary collapse

Methods inherited from Logic::Mutation

#response_class

Instance Method Details

#query(key:, type:, id: nil, import: true, client_mutation_id: nil, **kargs, &block) ⇒ Object



49
50
51
52
# File 'lib/ecoportal/api/graphql/mutation/image/upload.rb', line 49

def query(key:, type:, id: nil, import: true, client_mutation_id: nil, **kargs, &block)
  super(input: build_input(key: key, type: type, id: id, import: import,
                           client_mutation_id: client_mutation_id), **kargs, &block)
end