Commit b81a186 1 parent b20e7b1 commit b81a186 Copy full SHA for b81a186
File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ func LinkGithubInstallationToOrgApi(c *gin.Context) {
33
33
if errors .Is (err , gorm .ErrRecordNotFound ) {
34
34
log .Printf ("could not find organisation: %v" , err )
35
35
c .JSON (http .StatusNotFound , gin.H {"status" : "Could not find organisation: " + organisationId })
36
+ } else {
37
+ log .Printf ("database error while finding organisation: %v" , err )
38
+ c .JSON (http .StatusInternalServerError , gin.H {"status" : "Internal server error" })
36
39
}
37
40
return
38
41
}
Original file line number Diff line number Diff line change @@ -126,7 +126,12 @@ func (p *Project) MapToJsonStruct() interface{} {
126
126
}
127
127
}
128
128
func (r * Repo ) MapToJsonStruct () interface {} {
129
-
129
+ OrganisationName := func () string {
130
+ if r .Organisation == nil {
131
+ return ""
132
+ }
133
+ return r .Organisation .Name
134
+ }
130
135
return struct {
131
136
Id uint `json:"id"`
132
137
Name string `json:"name"`
@@ -142,7 +147,7 @@ func (r *Repo) MapToJsonStruct() interface{} {
142
147
RepoUrl : r .RepoUrl ,
143
148
VCS : string (r .VCS ),
144
149
OrganisationID : r .OrganisationID ,
145
- OrganisationName : r . Organisation . Name ,
150
+ OrganisationName : OrganisationName () ,
146
151
}
147
152
}
148
153
You can’t perform that action at this time.
0 commit comments