Skip to content

Commit

Permalink
Add enum for WfRequest status; use JSONB for data fields
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Nov 11, 2024
1 parent a1fded7 commit ea10cf9
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,23 @@ type FilterStattuCount struct {
Failed int64 `json:"failed"`
}

type WfRequestStatus string

const (
StatusNew WfRequestStatus = "NEW"
StatusPending WfRequestStatus = "PENDING"
StatusCompleted WfRequestStatus = "COMPLETED"
StatusFailed WfRequestStatus = "FAILED"
)

type WfRequest struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
RequestID string `gorm:"unique;not null" json:"request_id"`
Status string `json:"status"`
RequestData JSONB `json:"request_data"`
ResponseData JSONB `gorm:"type:jsonb" json:"response_data,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
RequestID string `gorm:"unique;not null" json:"request_id"`
Status WfRequestStatus `json:"status"`
RequestData JSONB `gorm:"type:jsonb" json:"request_data"`
ResponseData JSONB `gorm:"type:jsonb" json:"response_data,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}

func (Person) TableName() string {
Expand Down

0 comments on commit ea10cf9

Please sign in to comment.