[FIX] Add repo_pullreq_seq to pullreq read APIs (#158)

This commit is contained in:
Johannes Batzill 2023-01-05 01:06:55 -08:00 committed by GitHub
parent 7ada1af3aa
commit d61e876de0
2 changed files with 6 additions and 2 deletions

View File

@ -74,16 +74,19 @@ func (c *Controller) Create(
return nil, usererror.BadRequest("a pull request for this target and source branch already exists")
}
targetRepo, _ = c.repoStore.UpdateOptLock(ctx, targetRepo, func(repo *types.Repository) error {
targetRepo, err = c.repoStore.UpdateOptLock(ctx, targetRepo, func(repo *types.Repository) error {
repo.PullReqSeq++
return nil
})
if err != nil {
return nil, fmt.Errorf("failed to aquire PullReqSeq number: %w", err)
}
pr := newPullReq(session, targetRepo.PullReqSeq, sourceRepo, targetRepo, in)
err = c.pullreqStore.Create(ctx, pr)
if err != nil {
return nil, err
return nil, fmt.Errorf("pullreq creation failed: %w", err)
}
return pr, nil

View File

@ -418,6 +418,7 @@ repo_id
,repo_updated
,repo_git_uid
,repo_default_branch
,repo_pullreq_seq
,repo_fork_id
,repo_num_forks
,repo_num_pulls