Class: Mutations::Ml::ModelVersions::Create
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::Ml::ModelVersions::Create
- Includes:
- FindsProject
- Defined in:
- app/graphql/mutations/ml/model_versions/create.rb
Constant Summary
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, authorization_scopes, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Instance Method Details
#resolve(**args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/graphql/mutations/ml/model_versions/create.rb', line 33 def resolve(**args) project = (args[:project_path]) model = ::Ml::Model.by_project_id_and_id(project.id, args[:model_id].model_id) return { errors: ['Model not found'] } unless model result = ::Ml::CreateModelVersionService.new(model, { version: args[:version], description: args[:description], user: current_user } ).execute { model_version: result.payload[:model_version], errors: result. } end |