Skip to content

Commit 96815d3

Browse files
committed
Add StorageConfigured field to CiWorkflowStatusLatest and update services to handle it.
Integrate `BlobStorageEnabled` from the data model and replace default hardcoded value in `WorkflowStatusUpdateServiceImpl`.
1 parent cb6ce49 commit 96815d3

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

pkg/workflow/status/workflowStatusLatest/WorkflowStatusLatestService.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ func NewWorkflowStatusLatestServiceImpl(
6060
}
6161
}
6262

63-
// DTOs for service layer
6463
type CiWorkflowStatusLatest struct {
65-
PipelineId int `json:"pipelineId"`
66-
AppId int `json:"appId"`
67-
CiWorkflowId int `json:"ciWorkflowId"`
68-
Status string `json:"status"` // Derived from ci_workflow table
64+
PipelineId int `json:"pipelineId"`
65+
AppId int `json:"appId"`
66+
CiWorkflowId int `json:"ciWorkflowId"`
67+
Status string `json:"status"` // Derived from ci_workflow table
68+
StorageConfigured bool `json:"storageConfigured"`
6969
}
7070

7171
type CdWorkflowStatusLatest struct {
@@ -153,10 +153,11 @@ func (impl *WorkflowStatusLatestServiceImpl) GetCiWorkflowStatusLatestByAppId(ap
153153
}
154154

155155
result = append(result, &CiWorkflowStatusLatest{
156-
PipelineId: model.PipelineId,
157-
AppId: model.AppId,
158-
CiWorkflowId: model.CiWorkflowId,
159-
Status: ciWorkflow.Status,
156+
PipelineId: model.PipelineId,
157+
AppId: model.AppId,
158+
CiWorkflowId: model.CiWorkflowId,
159+
Status: ciWorkflow.Status,
160+
StorageConfigured: ciWorkflow.BlobStorageEnabled,
160161
})
161162
}
162163

pkg/workflow/status/workflowStatusLatest/WorkflowStatusUpdateService.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func (impl *WorkflowStatusUpdateServiceImpl) UpdateCdWorkflowStatusLatest(pipeli
6767
}
6868

6969
func (impl *WorkflowStatusUpdateServiceImpl) FetchCiStatusForTriggerViewOptimized(appId int) ([]*pipelineConfig.CiWorkflowStatus, error) {
70-
// First try to get from the optimized latest status table
7170
latestStatuses, err := impl.workflowStatusLatestService.GetCiWorkflowStatusLatestByAppId(appId)
7271
if err != nil {
7372
impl.logger.Errorw("error in getting ci workflow status latest by app id", "err", err, "appId", appId)
@@ -78,7 +77,6 @@ func (impl *WorkflowStatusUpdateServiceImpl) FetchCiStatusForTriggerViewOptimize
7877
// Convert to the expected format
7978
var ciWorkflowStatuses []*pipelineConfig.CiWorkflowStatus
8079
for _, latestStatus := range latestStatuses {
81-
// Get pipeline name from CI pipeline repository
8280
ciPipeline, err := impl.ciPipelineRepository.FindById(latestStatus.PipelineId)
8381
if err != nil {
8482
impl.logger.Errorw("error in getting ci pipeline", "err", err, "pipelineId", latestStatus.PipelineId)
@@ -90,7 +88,7 @@ func (impl *WorkflowStatusUpdateServiceImpl) FetchCiStatusForTriggerViewOptimize
9088
CiPipelineName: ciPipeline.Name,
9189
CiStatus: latestStatus.Status,
9290
CiWorkflowId: latestStatus.CiWorkflowId,
93-
StorageConfigured: true, // Default value, can be enhanced later
91+
StorageConfigured: latestStatus.StorageConfigured,
9492
}
9593
ciWorkflowStatuses = append(ciWorkflowStatuses, ciWorkflowStatus)
9694
}

0 commit comments

Comments
 (0)