2022-05-07 20:08:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Users
|
|
|
|
module SavedReplies
|
|
|
|
class UpdateService
|
2022-06-21 17:19:12 +05:30
|
|
|
def initialize(saved_reply:, name:, content:)
|
2022-05-07 20:08:51 +05:30
|
|
|
@saved_reply = saved_reply
|
|
|
|
@name = name
|
|
|
|
@content = content
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
if saved_reply.update(name: name, content: content)
|
|
|
|
ServiceResponse.success(payload: { saved_reply: saved_reply.reset })
|
|
|
|
else
|
|
|
|
ServiceResponse.error(message: saved_reply.errors.full_messages)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
attr_reader :saved_reply, :name, :content
|
2022-05-07 20:08:51 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|