move find cron for branch to correct query

This commit is contained in:
Steffen Kötte 2016-02-01 15:23:15 +01:00
parent d75daab82f
commit 98a75e5931
3 changed files with 5 additions and 5 deletions

View File

@ -8,5 +8,9 @@ module Travis::API::V3
return Models::Cron.find_by_id(id) if id
raise WrongParams, 'missing cron.id'.freeze
end
def find_for_branch(branch)
branch.cron
end
end
end

View File

@ -1,10 +1,6 @@
module Travis::API::V3
class Queries::Crons < Query
def find(branch)
branch.cron
end
def start(branch)
raise ServerError, 'repository does not have a github_id'.freeze unless branch.repository.github_id

View File

@ -2,7 +2,7 @@ module Travis::API::V3
class Services::Cron::ForBranch < Service
def run!
Models::Cron.where(:branch_id => find(:branch, find(:repository))).first
query.find_for_branch(find(:branch, find(:repository)))
end
end
end