ADD paginate for builds api

This commit is contained in:
Jasder
2020-08-25 15:43:30 +08:00
parent 4932eae285
commit 1ea9e420be
8 changed files with 60 additions and 5 deletions

View File

@@ -3,4 +3,11 @@ class Ci::Build < Ci::RemoteBase
belongs_to :repo, foreign_key: :build_repo_id
has_many :stages, foreign_key: "stage_build_id", dependent: :destroy
scope :successed, ->{ by_status('success') }
scope :failed, -> { by_status('failure') }
scope :running, -> { by_status('running') }
scope :errored, -> { by_status('error') }
scope :pending, -> { by_status('pending') }
scope :by_status, ->(status) { where(build_status: status) }
end

View File

@@ -16,4 +16,11 @@ class Ci::Repo < Ci::RemoteBase
[user, repo]
end
def enable
update_column(:repo_config, '.trustie-pipeline.yml')
end
def activate
end
end