diff options
Diffstat (limited to 'app/services/ml/model_versions/update_model_version_service.rb')
-rw-r--r-- | app/services/ml/model_versions/update_model_version_service.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/services/ml/model_versions/update_model_version_service.rb b/app/services/ml/model_versions/update_model_version_service.rb new file mode 100644 index 00000000000..a0de87792f8 --- /dev/null +++ b/app/services/ml/model_versions/update_model_version_service.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Ml + module ModelVersions + class UpdateModelVersionService + def initialize(project, name, version, description) + @project = project + @name = name + @version = version + @description = description + end + + def execute + model_version = Ml::ModelVersion + .by_project_id_name_and_version(@project.id, @name, @version) + + return ServiceResponse.error(message: 'Model not found') unless model_version.present? + + result = model_version.update(description: @description) + + return ServiceResponse.error(message: 'Model update failed') unless result + + ServiceResponse.success(payload: model_version) + end + end + end +end |