新增:加入同步方向逻辑

This commit is contained in:
2024-05-08 11:13:02 +08:00
parent b3a51f2f74
commit a98fe05599
2 changed files with 17 additions and 1 deletions

View File

@@ -22,5 +22,17 @@ class SyncRepositoryBranch < ApplicationRecord
belongs_to :sync_repository
before_destroy :unbind_reposyncer
enum sync_status: {success: 1, failure: 2}
def unbind_reposyncer
if self.sync_repository.sync_direction.to_i == 1
Reposync::DeleteRepoService.call(self.sync_repository&.repo_name, self.gitlink_branch_name)
else
Reposync::DeleteRepoService.call(self.sync_repository&.repo_name, self.external_branch_name)
end
end
end