deployment.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. }
  34. func (d *Deployment) ToDeploymentType() *types.Deployment {
  35. return &types.Deployment{
  36. ID: d.Model.ID,
  37. EnvironmentID: d.EnvironmentID,
  38. Namespace: d.Namespace,
  39. Status: d.Status,
  40. Subdomain: d.Subdomain,
  41. PullRequestID: d.PullRequestID,
  42. }
  43. }