diff --git a/app/interactors/start_match.rb b/app/interactors/start_match.rb new file mode 100644 index 0000000..45d7e69 --- /dev/null +++ b/app/interactors/start_match.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class StartMatch + include Interactor + + def call + match = context.match + begin + match = MatchService.start_match(match) + context.object_to_save = match + rescue StandardError + context.fail! + end + end +end diff --git a/app/services/match_service.rb b/app/services/match_service.rb index adf2995..26d0095 100644 --- a/app/services/match_service.rb +++ b/app/services/match_service.rb @@ -1,6 +1,12 @@ # frozen_string_literal: true class MatchService + # Starts a Match; setting its state to running + # + # @param match Match the Match to be started + # @return Match the resulting Match + def self.start_match(match); end + # Generates all necessary matches from a list of teams # # @param teams [Array] the teams to generate matches with