Class: Mutations::ReleaseAssetLinks::Update
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::ReleaseAssetLinks::Update
- Defined in:
- app/graphql/mutations/release_asset_links/update.rb
Constant Summary collapse
- ReleaseAssetLinkID =
::Types::GlobalIDType[::Releases::Link]
Constants inherited from BaseMutation
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Instance Method Summary collapse
Methods inherited from BaseMutation
#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #unauthorized_object
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Instance Method Details
#ready?(**args) ⇒ Boolean
37 38 39 40 41 42 43 44 |
# File 'app/graphql/mutations/release_asset_links/update.rb', line 37 def ready?(**args) if args.key?(:link_type) && args[:link_type].nil? raise Gitlab::Graphql::Errors::ArgumentError, 'if the linkType argument is provided, it cannot be null' end super end |
#resolve(id:, **link_attrs) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/graphql/mutations/release_asset_links/update.rb', line 46 def resolve(id:, **link_attrs) link = (id: id) result = ::Releases::Links::UpdateService .new(link.release, current_user, link_attrs) .execute(link) if result.success? { link: result.payload[:link], errors: [] } else { link: nil, errors: result. } end end |