diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-14 18:12:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-14 18:12:05 +0300 |
commit | b119503b7039d1e79b87300a145afdcd1145c2d6 (patch) | |
tree | 9977d51c4fd8177a20f1805c14f0cb6750baee1c /app/services/todos | |
parent | d378fdaa60adb7217e3fc798580ad206127728d5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/todos')
-rw-r--r-- | app/services/todos/destroy/design_service.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/services/todos/destroy/design_service.rb b/app/services/todos/destroy/design_service.rb new file mode 100644 index 00000000000..a375d659159 --- /dev/null +++ b/app/services/todos/destroy/design_service.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Todos + module Destroy + # Service class for deleting todos that belongs to a deleted/archived design. + class DesignService + attr_reader :design_ids + + def initialize(design_ids) + @design_ids = design_ids + end + + def execute + todos.delete_all + end + + private + + def todos + Todo.for_target(deleted_designs.select(:design_id)).for_type(DesignManagement::Design) + end + + def deleted_designs + DesignManagement::Action.by_design(design_ids).by_event(:deletion) + end + end + end +end |