Skip to content

Commit 3523d62

Browse files
committed
fix: solve harcoded codes
1 parent bfaef29 commit 3523d62

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

backend/controllers/cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) {
3535
link, err := models.DB.GetGithubAppInstallationLink(installationId)
3636
if err != nil {
3737
slog.Error("Could not get installation link", "error", err, "repoFullName", repoFullName, "installationId", installationId)
38-
c.String(500, fmt.Sprintf("coulnt not find installation link %v %v", repoFullName, installationId))
38+
c.String(http.StatusInternalServerError, fmt.Sprintf("coulnt not find installation link %v %v", repoFullName, installationId))
3939
return
4040
}
4141
orgId := link.OrganisationId
@@ -48,7 +48,7 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) {
4848
repo, err := models.DB.GetRepo(orgId, repoDiggerName)
4949
if err != nil {
5050
slog.Error("Could not get repo", "error", err, "repoFullName", repoFullName, "orgId", orgId)
51-
c.String(500, fmt.Sprintf("coulnt not get repository %v %v", repoFullName, orgId))
51+
c.String(http.StatusInternalServerError, fmt.Sprintf("coulnt not get repository %v %v", repoFullName, orgId))
5252
return
5353
}
5454

@@ -58,7 +58,7 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) {
5858
_, token, err := utils.GetGithubService(d.GithubClientProvider, installationId, repoFullName, repoOwner, repoName)
5959
if err != nil {
6060
slog.Error("Could not get GitHub service", "error", err, "repoFullName", repoFullName, "orgId", orgId)
61-
c.String(500, fmt.Sprintf("could not get github service %v %v", repoFullName, orgId))
61+
c.String(http.StatusInternalServerError, fmt.Sprintf("could not get github service %v %v", repoFullName, orgId))
6262
return
6363
}
6464

@@ -90,5 +90,5 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) {
9090
slog.Info("Successfully updated repo cache", "repoFullName", repoFullName, "orgId", orgId)
9191
}()
9292

93-
c.String(200, "successfully submitted cache for processing, check backend logs for progress")
93+
c.String(http.StatusOK, "successfully submitted cache for processing, check backend logs for progress")
9494
}

backend/controllers/github_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func LinkGithubInstallationToOrgApi(c *gin.Context) {
6060
if link != nil {
6161
if link.OrganisationId == org.ID {
6262
slog.Info("Installation already linked to this org", "installationId", installationId, "orgId", org.ID)
63-
c.JSON(200, gin.H{"status": "already linked to this org"})
63+
c.JSON(http.StatusOK, gin.H{"status": "already linked to this org"})
6464
return
6565
} else {
6666
slog.Warn("Installation ID already linked to another org",

0 commit comments

Comments
 (0)