Skip to content

Commit

Permalink
add type to status (#4172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Jan 19, 2024
1 parent f120bcf commit 0a67797
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/datastore/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func CreateOrGetRecord(ctx context.Context, inp CreateOrGetRecordInput) (*models
Engine: inp.Engine,
CloudProvider: cluster.CloudProvider,
CloudProviderCredentialIdentifier: cluster.CloudProviderCredentialIdentifier,
Status: models.DatastoreStatus_Creating,
}

datastore, err = inp.DatastoreRepository.Insert(ctx, datastoreToSave)
Expand Down
12 changes: 11 additions & 1 deletion internal/models/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ import (
"gorm.io/gorm"
)

// DatastoreStatus is the status of an app revision
type DatastoreStatus string

const (
// DatastoreStatus_Creating is the status for a datastore that is being created
DatastoreStatus_Creating DatastoreStatus = "CREATING"
// DatastoreStatus_Available is the status for a datastore that is available
DatastoreStatus_Available DatastoreStatus = "AVAILABLE"
)

// Datastore is a database model that represents a Porter-provisioned datastore
type Datastore struct {
gorm.Model
Expand Down Expand Up @@ -33,5 +43,5 @@ type Datastore struct {
Engine string `json:"engine"`

// Status describes the status of a datastore
Status string `json:"status"`
Status DatastoreStatus `json:"status"`
}

0 comments on commit 0a67797

Please sign in to comment.