Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(vcs): use string to represent external repository ID (#4856)

Joe Chen9f9a7c2ab34e
diff --git a/backend/legacyapi/vcs.go b/backend/legacyapi/vcs.go
index c1f6d980f1..10fe7b1ee8 100644
--- a/backend/legacyapi/vcs.go
+++ b/backend/legacyapi/vcs.go
@@ -75,7 +75,7 @@ type VCSDelete struct {
// ExternalRepository is the API message for external repository.
type ExternalRepository struct {
- ID int64 `jsonapi:"primary,id"`
+ ID string `jsonapi:"primary,id"`
Name string `jsonapi:"attr,name"`
FullPath string `jsonapi:"attr,fullPath"`
WebURL string `jsonapi:"attr,webUrl"`
diff --git a/backend/plugin/vcs/github/github.go b/backend/plugin/vcs/github/github.go
index 7b4bd957c8..e2a283a34f 100644
--- a/backend/plugin/vcs/github/github.go
+++ b/backend/plugin/vcs/github/github.go
@@ -449,7 +449,7 @@ func (p *Provider) FetchAllRepositoryList(ctx context.Context, oauthCtx common.O
}
allRepos = append(allRepos,
&vcs.Repository{
- ID: r.ID,
+ ID: strconv.FormatInt(r.ID, 10),
Name: r.Name,
FullPath: r.FullName,
WebURL: r.HTMLURL,
diff --git a/backend/plugin/vcs/github/github_test.go b/backend/plugin/vcs/github/github_test.go
index b6ca34d15b..d10593ce42 100644
--- a/backend/plugin/vcs/github/github_test.go
+++ b/backend/plugin/vcs/github/github_test.go
@@ -267,7 +267,7 @@ func TestProvider_FetchAllRepositoryList(t *testing.T) {
// Repositories without admin permissions should be excluded
want := []*vcs.Repository{
{
- ID: 1296269,
+ ID: "1296269",
Name: "Hello-World",
FullPath: "octocat/Hello-World",
WebURL: "https://github.com/octocat/Hello-World",
diff --git a/backend/plugin/vcs/gitlab/gitlab.go b/backend/plugin/vcs/gitlab/gitlab.go
index 798debf9cc..1b8a7e72b6 100644
--- a/backend/plugin/vcs/gitlab/gitlab.go
+++ b/backend/plugin/vcs/gitlab/gitlab.go
@@ -253,7 +253,7 @@ func (p *Provider) FetchAllRepositoryList(ctx context.Context, oauthCtx common.O
for _, r := range gitlabRepos {
allRepos = append(allRepos,
&vcs.Repository{
- ID: r.ID,
+ ID: strconv.FormatInt(r.ID, 10),
Name: r.Name,
FullPath: r.PathWithNamespace,
WebURL: r.WebURL,
diff --git a/backend/plugin/vcs/gitlab/gitlab_test.go b/backend/plugin/vcs/gitlab/gitlab_test.go
index 37facb8ebf..0c5df5664c 100644
--- a/backend/plugin/vcs/gitlab/gitlab_test.go
+++ b/backend/plugin/vcs/gitlab/gitlab_test.go
@@ -156,7 +156,7 @@ func TestProvider_FetchAllRepositoryList(t *testing.T) {
want := []*vcs.Repository{
{
- ID: 4,
+ ID: "4",
Name: "Diaspora Client",
FullPath: "diaspora/diaspora-client",
WebURL: "http://example.com/diaspora/diaspora-client",
diff --git a/backend/plugin/vcs/vcs.go b/backend/plugin/vcs/vcs.go
index 0d80d07118..ad7efa6c2c 100644
--- a/backend/plugin/vcs/vcs.go
+++ b/backend/plugin/vcs/vcs.go
@@ -146,7 +146,7 @@ type UserInfo struct {
// Repository is the API message for repository info.
type Repository struct {
- ID int64 `json:"id"`
+ ID string `json:"id"`
Name string `json:"name"`
FullPath string `json:"fullPath"`
WebURL string `json:"webUrl"`
diff --git a/frontend/src/store/modules/repository.ts b/frontend/src/store/modules/repository.ts
index 10a66dbf03..dca5ece91a 100644
--- a/frontend/src/store/modules/repository.ts
+++ b/frontend/src/store/modules/repository.ts
@@ -45,7 +45,7 @@ function convert(
return {
...(repository.attributes as Omit<Repository, "id" | "vcs" | "project">),
- id: parseInt(repository.id),
+ id: repository.id,
vcs,
project,
};