changes for new db structure
This commit is contained in:
parent
e4aec173ee
commit
b45b3fadf7
|
@ -4,7 +4,7 @@ module Travis::API::V3
|
|||
belongs_to :last_build, class_name: 'Travis::API::V3::Models::Build'.freeze
|
||||
has_many :builds, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'builds.id DESC'.freeze, conditions: { event_type: 'push' }
|
||||
has_many :commits, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'commits.id DESC'.freeze
|
||||
has_many :crons, dependent: :delete_all
|
||||
has_one :crons, dependent: :delete
|
||||
|
||||
def default_branch
|
||||
name == repository.default_branch_name
|
||||
|
|
|
@ -86,7 +86,7 @@ module Travis::API::V3
|
|||
get :find
|
||||
|
||||
resource :crons do
|
||||
route '/crons'
|
||||
route '/cron'
|
||||
get :find
|
||||
|
||||
post :create, '/create'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Travis::API::V3
|
||||
class Services::Crons::Create < Service
|
||||
result_type :cron
|
||||
params :mon, :tue, :wed, :thu, :fri, :sat, :sun, :disable_by_push, :hour
|
||||
params :type, :disable_by_build
|
||||
|
||||
def run!
|
||||
raise LoginRequired unless access_control.logged_in? or access_control.full_access?
|
||||
|
@ -9,15 +9,8 @@ module Travis::API::V3
|
|||
raise NotFound unless branch = find(:branch, repository)
|
||||
access_control.permissions(repository).create_cron!
|
||||
Models::Cron.create(branch: branch,
|
||||
mon: value("mon"),
|
||||
tue: value("tue"),
|
||||
wed: value("wed"),
|
||||
thu: value("thu"),
|
||||
fri: value("fri"),
|
||||
sat: value("sat"),
|
||||
sun: value("sun"),
|
||||
hour: params["hour"],
|
||||
disable_by_push: value("disable_by_push"))
|
||||
type: params["type"],
|
||||
disable_by_build: value("disable_by_build"))
|
||||
end
|
||||
|
||||
def value s
|
||||
|
|
Loading…
Reference in New Issue
Block a user