2
0

github_app.go 709 B

1234567891011121314151617181920212223242526
  1. package integrations
  2. import (
  3. "github.com/porter-dev/porter/api/types"
  4. "gorm.io/gorm"
  5. )
  6. // GithubAppInstallation is an instance of the porter github app
  7. // we need to store account/installation id pairs in order to authenticate as the installation
  8. type GithubAppInstallation struct {
  9. gorm.Model
  10. // Can belong to either a user or an organization
  11. AccountID int64 `json:"account_id" gorm:"unique"`
  12. // Installation ID (used for authentication)
  13. InstallationID int64 `json:"installation_id"`
  14. }
  15. func (r *GithubAppInstallation) ToGitInstallationType() *types.GitInstallation {
  16. return &types.GitInstallation{
  17. ID: r.ID,
  18. AccountID: r.AccountID,
  19. InstallationID: r.InstallationID,
  20. }
  21. }