api_contract_revision.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package models
  2. import (
  3. "github.com/google/uuid"
  4. "gorm.io/gorm"
  5. )
  6. // APIContractRevision represents a revision of an API contract
  7. type APIContractRevision struct {
  8. gorm.Model
  9. // ID is a UUID for the APIContract
  10. ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
  11. // Base64Contract is the APIContract as json encoded in base64
  12. Base64Contract string `json:"base64_contract"`
  13. // ClusterID is the ID of the cluster that the config created.
  14. // This should be a foreign key, but GORM doesnt play well with FKs.
  15. ClusterID int `json:"cluster_id"`
  16. // ProjectID is the ID of the project that the config belongs to.
  17. // This should be a foreign key, but GORM doesnt play well with FKs.
  18. ProjectID int `json:"project_id"`
  19. // Condition is the status of the apply that happened for this revision.
  20. // Condition will contain any failure reasons for a revision, or "SUCCESS" if the revision was applied successfully.
  21. Condition string `json:"condition"`
  22. }
  23. // TableName overrides the table name
  24. func (APIContractRevision) TableName() string {
  25. return "api_contract_revisions"
  26. }