Add Summary to trips

This commit is contained in:
2023-08-27 17:06:20 +10:00
parent ee3703853d
commit 425e93c056
7 changed files with 37 additions and 4 deletions

View File

@@ -3,13 +3,20 @@ module Admin
module Trips
class Update
include Dry::Monads[:result]
include Deps["repos.trip_repo"]
include Deps["repos.trip_repo", renderer: "renderers.markdown"]
def call(id:, trip:)
trip_repo.update(id, trip)
trip_repo.update(id, prepare(trip: trip))
Success()
end
private
def prepare(trip:)
trip[:summary] = renderer.call(content: trip[:summary])
trip
end
end
end
end