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
|
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 :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 :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
|
def default_branch
|
||||||
name == repository.default_branch_name
|
name == repository.default_branch_name
|
||||||
|
|
|
@ -86,7 +86,7 @@ module Travis::API::V3
|
||||||
get :find
|
get :find
|
||||||
|
|
||||||
resource :crons do
|
resource :crons do
|
||||||
route '/crons'
|
route '/cron'
|
||||||
get :find
|
get :find
|
||||||
|
|
||||||
post :create, '/create'
|
post :create, '/create'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Travis::API::V3
|
module Travis::API::V3
|
||||||
class Services::Crons::Create < Service
|
class Services::Crons::Create < Service
|
||||||
result_type :cron
|
result_type :cron
|
||||||
params :mon, :tue, :wed, :thu, :fri, :sat, :sun, :disable_by_push, :hour
|
params :type, :disable_by_build
|
||||||
|
|
||||||
def run!
|
def run!
|
||||||
raise LoginRequired unless access_control.logged_in? or access_control.full_access?
|
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)
|
raise NotFound unless branch = find(:branch, repository)
|
||||||
access_control.permissions(repository).create_cron!
|
access_control.permissions(repository).create_cron!
|
||||||
Models::Cron.create(branch: branch,
|
Models::Cron.create(branch: branch,
|
||||||
mon: value("mon"),
|
type: params["type"],
|
||||||
tue: value("tue"),
|
disable_by_build: value("disable_by_build"))
|
||||||
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"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def value s
|
def value s
|
||||||
|
|
Loading…
Reference in New Issue
Block a user