reposyncer同步仓库接口

This commit is contained in:
“xxq250”
2022-07-26 10:44:12 +08:00
parent 0df1e5fdd0
commit 1bbde165c2
9 changed files with 377 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
# == Schema Information
#
# Table name: ob_repository_syncs
#
# id :integer not null, primary key
# project_id :integer
# user_id :integer
# name :string(255)
# github_address :string(255)
# gitee_address :string(255)
# github_token :string(255)
# gitee_token :string(255)
# sync_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_ob_repository_syncs_on_project_id (project_id)
# index_ob_repository_syncs_on_user_id (user_id)
#
class ObRepositorySync < ApplicationRecord
belongs_to :project
belongs_to :user
has_many :ob_repository_sync_jobs, dependent: :destroy
end

View File

@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: ob_repository_sync_jobs
#
# id :integer not null, primary key
# ob_repository_sync_id :integer
# github_branch :string(255)
# gitee_branch :string(255)
# gitlink_branch :string(255)
# job_type :string(255)
# base :string(255)
# job_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_ob_repository_sync_jobs_on_ob_repository_sync_id (ob_repository_sync_id)
#
class ObRepositorySyncJob < ApplicationRecord
belongs_to :ob_repository_sync
end

View File

@@ -49,7 +49,7 @@ class Repository < ApplicationRecord
end
def url
self['url'].blank? ? "#{Rails.application.config_for(:configuration)['platform_url']}/#{self.owner&.login}/#{self.identifier}.git" : self['url']
self['url'].blank? ? "#{Gitea.gitea_config[:domain]}/#{self.owner&.login}/#{self.identifier}.git" : self['url']
end
# with repository is mirror