environment.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package models
  2. import (
  3. "github.com/porter-dev/porter/api/types"
  4. "gorm.io/gorm"
  5. )
  6. type Environment struct {
  7. gorm.Model
  8. ProjectID uint
  9. ClusterID uint
  10. GitInstallationID uint
  11. GitRepoOwner string
  12. GitRepoName string
  13. Name string
  14. }
  15. func (e *Environment) ToEnvironmentType() *types.Environment {
  16. return &types.Environment{
  17. ID: e.Model.ID,
  18. ProjectID: e.ProjectID,
  19. ClusterID: e.ClusterID,
  20. GitInstallationID: e.GitInstallationID,
  21. GitRepoOwner: e.GitRepoOwner,
  22. GitRepoName: e.GitRepoName,
  23. Name: e.Name,
  24. }
  25. }
  26. type Deployment struct {
  27. gorm.Model
  28. EnvironmentID uint
  29. Namespace string
  30. Status string
  31. Subdomain string
  32. PullRequestID uint
  33. GitHubDeploymentID int64
  34. }
  35. func (d *Deployment) ToDeploymentType() *types.Deployment {
  36. return &types.Deployment{
  37. ID: d.Model.ID,
  38. EnvironmentID: d.EnvironmentID,
  39. Namespace: d.Namespace,
  40. Status: d.Status,
  41. Subdomain: d.Subdomain,
  42. PullRequestID: d.PullRequestID,
  43. GitHubDeploymentID: d.GitHubDeploymentID,
  44. }
  45. }