Task create and update

This commit is contained in:
2025-07-12 18:00:56 +03:00
parent 4f5b9dcf89
commit 586f2cf3ee
7 changed files with 132 additions and 8 deletions
+22
View File
@@ -0,0 +1,22 @@
# frozen_string_literal: true
module Tasks
class Update < ApplicationService
attribute :id, :integer
attribute :title, :string
attribute :description, :string
validates :title, presence: true
delegate :model_name, to: Task
def persisted? = true
def perform(task)
@task = task
@id = task.id
@task.assign_attributes(title:, description:)
save @task
end
end
end