move find cron for repository to query

This commit is contained in:
Steffen Kötte 2016-02-01 16:20:50 +01:00
parent 6fb0f7b6ce
commit be01b36f05
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -3,7 +3,7 @@ module Travis::API::V3
paginate
def run!
Models::Cron.where(:branch_id => find(:repository).branches)
query.find(find(:repository))
end
end
end