porter_app_event.go 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package test
  2. import (
  3. "context"
  4. "errors"
  5. "github.com/google/uuid"
  6. "github.com/porter-dev/porter/internal/models"
  7. "github.com/porter-dev/porter/internal/repository"
  8. "github.com/porter-dev/porter/internal/repository/gorm/helpers"
  9. )
  10. type PorterAppEventRepository struct {
  11. canQuery bool
  12. }
  13. func NewPorterAppEventRepository(canQuery bool, failingMethods ...string) repository.PorterAppEventRepository {
  14. return &PorterAppEventRepository{canQuery: false}
  15. }
  16. func (repo *PorterAppEventRepository) ListEventsByPorterAppID(ctx context.Context, porterAppID uint, opts ...helpers.QueryOption) ([]*models.PorterAppEvent, helpers.PaginatedResult, error) {
  17. return nil, helpers.PaginatedResult{}, errors.New("cannot write database")
  18. }
  19. // ListEventsByPorterAppIDAndDeploymentTargetID is a test method
  20. func (repo *PorterAppEventRepository) ListEventsByPorterAppIDAndDeploymentTargetID(ctx context.Context, porterAppID uint, deploymentTargetID uuid.UUID, opts ...helpers.QueryOption) ([]*models.PorterAppEvent, helpers.PaginatedResult, error) {
  21. return nil, helpers.PaginatedResult{}, errors.New("cannot write database")
  22. }
  23. // ListBuildDeployEventsByPorterAppIDAndDeploymentTargetID is a test method
  24. func (repo *PorterAppEventRepository) ListBuildDeployEventsByPorterAppIDAndDeploymentTargetID(ctx context.Context, porterAppID uint, deploymentTargetID uuid.UUID, opts ...helpers.QueryOption) ([]*models.PorterAppEvent, helpers.PaginatedResult, error) {
  25. return nil, helpers.PaginatedResult{}, errors.New("cannot write database")
  26. }
  27. func (repo *PorterAppEventRepository) CreateEvent(ctx context.Context, appEvent *models.PorterAppEvent) error {
  28. return errors.New("cannot write database")
  29. }
  30. func (repo *PorterAppEventRepository) UpdateEvent(ctx context.Context, appEvent *models.PorterAppEvent) error {
  31. return errors.New("cannot update database")
  32. }
  33. func (repo *PorterAppEventRepository) ReadEvent(ctx context.Context, id uuid.UUID) (models.PorterAppEvent, error) {
  34. return models.PorterAppEvent{}, errors.New("cannot read database")
  35. }
  36. func (repo *PorterAppEventRepository) ReadDeployEventByRevision(ctx context.Context, porterAppID uint, revision float64) (models.PorterAppEvent, error) {
  37. return models.PorterAppEvent{}, errors.New("cannot read database")
  38. }
  39. // ReadDeployEventByAppRevisionID is a test method
  40. func (repo *PorterAppEventRepository) ReadDeployEventByAppRevisionID(ctx context.Context, porterAppID uint, appRevisionID string) (models.PorterAppEvent, error) {
  41. return models.PorterAppEvent{}, errors.New("cannot read database")
  42. }
  43. // ReadNotificationsByAppRevisionID is a test method
  44. func (repo *PorterAppEventRepository) ReadNotificationsByAppRevisionID(ctx context.Context, porterAppInstanceID uuid.UUID, appRevisionID string) ([]*models.PorterAppEvent, error) {
  45. return nil, errors.New("cannot read database")
  46. }
  47. // NotificationByID returns a notification by the notification id
  48. func (repo *PorterAppEventRepository) NotificationByID(ctx context.Context, notificationID string) (*models.PorterAppEvent, error) {
  49. return nil, errors.New("cannot read database")
  50. }