diff --git a/docs/api/apiv3/components/schemas/meeting_model.yml b/docs/api/apiv3/components/schemas/meeting_model.yml index 0b518a1d20ea..1650eb416184 100644 --- a/docs/api/apiv3/components/schemas/meeting_model.yml +++ b/docs/api/apiv3/components/schemas/meeting_model.yml @@ -38,7 +38,8 @@ properties: format: date-time description: The scheduled meeting start time. duration: - type: number + type: string + format: duration description: The meeting duration in hours. createdAt: type: string diff --git a/modules/meeting/lib/api/v3/meetings/meeting_representer.rb b/modules/meeting/lib/api/v3/meetings/meeting_representer.rb index d64aa415bbfa..e413081aa372 100644 --- a/modules/meeting/lib/api/v3/meetings/meeting_representer.rb +++ b/modules/meeting/lib/api/v3/meetings/meeting_representer.rb @@ -55,7 +55,11 @@ class MeetingRepresenter < ::API::Decorators::Single date_time_property :start_time date_time_property :end_time - property :duration + property :duration, + exec_context: :decorator, + getter: ->(*) do + datetime_formatter.format_duration_from_hours(represented.duration) + end associated_resource :author, v3_path: :user, diff --git a/modules/meeting/spec/lib/api/v3/meetings/meeting_representer_spec.rb b/modules/meeting/spec/lib/api/v3/meetings/meeting_representer_spec.rb index ca26ba5b5273..c586d21aa372 100644 --- a/modules/meeting/spec/lib/api/v3/meetings/meeting_representer_spec.rb +++ b/modules/meeting/spec/lib/api/v3/meetings/meeting_representer_spec.rb @@ -90,7 +90,7 @@ expect(subject).to be_json_eql(meeting.lock_version.to_json).at_path("lockVersion") expect(subject).to be_json_eql(meeting.start_time.utc.iso8601(3).to_json).at_path("startTime") expect(subject).to be_json_eql(meeting.end_time.utc.iso8601(3).to_json).at_path("endTime") - expect(subject).to be_json_eql(meeting.duration.to_json).at_path("duration") + expect(subject).to be_json_eql("PT1H".to_json).at_path("duration") expect(subject).to be_json_eql(meeting.location.to_json).at_path("location") expect(subject).to be_json_eql(meeting.created_at.utc.iso8601(3).to_json).at_path("createdAt")