diff --git a/db/config.go b/db/config.go index 4abd9f4cb..4be9de041 100644 --- a/db/config.go +++ b/db/config.go @@ -81,6 +81,7 @@ func InitDB() { db.AutoMigrate(&WorkspaceFeatures{}) db.AutoMigrate(&FeaturePhase{}) db.AutoMigrate(&FeatureStory{}) + db.AutoMigrate(&WfRequest{}) DB.MigrateTablesWithOrgUuid() DB.MigrateOrganizationToWorkspace() diff --git a/db/structs.go b/db/structs.go index 9a125ced6..443ac971e 100644 --- a/db/structs.go +++ b/db/structs.go @@ -910,6 +910,25 @@ 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 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 { return "people" } @@ -946,6 +965,10 @@ func (ConnectionCodesShort) TableName() string { return "connectioncodes" } +func (WfRequest) TableName() string { + return "wf_requests" +} + // PropertyMap ... type PropertyMap map[string]interface{} diff --git a/db/test_config.go b/db/test_config.go index 4416b8b55..60198f802 100644 --- a/db/test_config.go +++ b/db/test_config.go @@ -58,6 +58,7 @@ func InitTestDB() { db.AutoMigrate(&WorkspaceUsers{}) db.AutoMigrate(&WorkspaceUserRoles{}) db.AutoMigrate(&Bot{}) + db.AutoMigrate(&WfRequest{}) people := TestDB.GetAllPeople() for _, p := range people {