@@ -73,7 +73,7 @@ type CdWorkflowRepository interface {
73
73
FetchAllCdStagesLatestEntity (pipelineIds []int ) ([]* CdWorkflowStatus , error )
74
74
FetchAllCdStagesLatestEntityStatus (wfrIds []int ) ([]* CdWorkflowRunner , error )
75
75
ExistsByStatus (status string ) (bool , error )
76
-
76
+ FetchEnvAllCdStagesLatestEntityStatus ( wfrIds [] int , envID int ) ([] * CdWorkflowRunner , error )
77
77
FetchArtifactsByCdPipelineId (pipelineId int , runnerType apiBean.WorkflowType , offset , limit int , searchString string ) ([]CdWorkflowRunner , error )
78
78
GetLatestTriggersOfHelmPipelinesStuckInNonTerminalStatuses (getPipelineDeployedWithinHours int ) ([]* CdWorkflowRunner , error )
79
79
FindLatestRunnerByPipelineIdsAndRunnerType (ctx context.Context , pipelineIds []int , runnerType apiBean.WorkflowType ) ([]CdWorkflowRunner , error )
@@ -685,8 +685,23 @@ func (impl *CdWorkflowRepositoryImpl) FetchAllCdStagesLatestEntity(pipelineIds [
685
685
686
686
func (impl * CdWorkflowRepositoryImpl ) FetchAllCdStagesLatestEntityStatus (wfrIds []int ) ([]* CdWorkflowRunner , error ) {
687
687
var wfrList []* CdWorkflowRunner
688
- err := impl .dbConnection .Model (& wfrList ).Column ("cd_workflow_runner.*" ).
689
- Where ("cd_workflow_runner.id in (?)" , pg .In (wfrIds )).Select ()
688
+ err := impl .dbConnection .Model (& wfrList ).
689
+ Column ("cd_workflow_runner.id" , "cd_workflow_runner.status" ).
690
+ Where ("cd_workflow_runner.id in (?)" , pg .In (wfrIds )).
691
+ Select ()
692
+ return wfrList , err
693
+ }
694
+
695
+ func (impl * CdWorkflowRepositoryImpl ) FetchEnvAllCdStagesLatestEntityStatus (wfrIds []int , envID int ) ([]* CdWorkflowRunner , error ) {
696
+ var wfrList []* CdWorkflowRunner
697
+ query := `
698
+ select wfr.id, wfr.status
699
+ from cd_workflow_runner wfr
700
+ inner join cd_workflow wf on wf.id = wfr.cd_workflow_id
701
+ inner join pipeline p on p.id = wf.pipeline_id
702
+ where p.environment_id = ? and wfr.id in (?)
703
+ `
704
+ _ , err := impl .dbConnection .Query (& wfrList , query , envID , pg .In (wfrIds ))
690
705
return wfrList , err
691
706
}
692
707
0 commit comments