Skip to content

Commit

Permalink
modify drift app
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes committed Sep 25, 2024
1 parent 2465514 commit 3668072
Show file tree
Hide file tree
Showing 12 changed files with 464 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ee/drift/controllers/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (mc MainController) GithubAppCallbackPage(c *gin.Context) {
repoName := *repo.Name
repoUrl := fmt.Sprintf("https://github.com/%v", repoFullName)

_, _, err = dbmodels.CreateOrGetDiggerRepoForGithubRepo(repoFullName, repoOwner, repoName, repoUrl, installationId64, *installation.AppID, *installation.Account.ID, *installation.Account.Login)
_, _, err = dbmodels.CreateOrGetDiggerRepoForGithubRepo(repoFullName, repoOwner, repoName, repoUrl, installationId, *installation.AppID, *installation.Account.ID, *installation.Account.Login)
if err != nil {
log.Printf("createOrGetDiggerRepoForGithubRepo error: %v", err)
c.String(http.StatusInternalServerError, "createOrGetDiggerRepoForGithubRepo error: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions ee/drift/dbmodels/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
GithubAppInstallationLinkInactive GithubAppInstallationLinkStatus = "inactive"
)

func (db *Database) GetGithubInstallationLinkForInstallationId(installationId int64) (*model.GithubAppInstallationLink, error) {
func (db *Database) GetGithubInstallationLinkForInstallationId(installationId string) (*model.GithubAppInstallationLink, error) {
l := model.GithubAppInstallationLink{}
err := db.GormDB.Where("github_installation_id = ? AND status=?", installationId, GithubAppInstallationLinkActive).Find(&l).Error
if err != nil {
Expand All @@ -28,7 +28,7 @@ func (db *Database) GetGithubInstallationLinkForInstallationId(installationId in
return &l, nil
}

func CreateOrGetDiggerRepoForGithubRepo(ghRepoFullName string, ghRepoOrganisation string, ghRepoName string, ghRepoUrl string, installationId int64, githubAppId int64, accountId int64, login string) (*model.Repo, *model.Organisation, error) {
func CreateOrGetDiggerRepoForGithubRepo(ghRepoFullName string, ghRepoOrganisation string, ghRepoName string, ghRepoUrl string, installationId string, githubAppId int64, accountId int64, login string) (*model.Repo, *model.Organisation, error) {
link, err := DB.GetGithubInstallationLinkForInstallationId(installationId)
if err != nil {
log.Printf("Error fetching installation link: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion ee/drift/dbmodels/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (db *Database) CreateGithubInstallationLink(orgId string, installationId st
return &link, nil
}

func (db *Database) CreateRepo(name string, repoFullName string, repoOrganisation string, repoName string, repoUrl string, org *model.Organisation, diggerConfig string, githubInstallationId int64, githubAppId int64, accountId int64, login string) (*model.Repo, error) {
func (db *Database) CreateRepo(name string, repoFullName string, repoOrganisation string, repoName string, repoUrl string, org *model.Organisation, diggerConfig string, githubInstallationId string, githubAppId int64, accountId int64, login string) (*model.Repo, error) {
var repo model.Repo
// check if repo exist already, do nothing in this case
result := db.GormDB.Where("name = ? AND organization_id=?", name, org.ID).Find(&repo)
Expand Down
1 change: 1 addition & 0 deletions ee/drift/model/projects.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ee/drift/model/repos.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions ee/drift/model/user_settings.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ee/drift/model/users.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ee/drift/models_generated/gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion ee/drift/models_generated/projects.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ee/drift/models_generated/repos.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3668072

Please sign in to comment.