@@ -100,9 +100,11 @@ type PipelineRepository interface {
100
100
FindAllPipelineCreatedCountInLast24Hour () (pipelineCount int , err error )
101
101
FindAllDeletedPipelineCountInLast24Hour () (pipelineCount int , err error )
102
102
FindActiveByEnvId (envId int ) (pipelines []* Pipeline , err error )
103
+ FindActivePipelineAppIdsByEnvId (envId int ) ([]int , error )
103
104
FindActivePipelineByEnvId (envId int ) (pipelines []* Pipeline , err error )
104
105
FindActiveByEnvIds (envId []int ) (pipelines []* Pipeline , err error )
105
106
FindActiveByInFilter (envId int , appIdIncludes []int ) (pipelines []* Pipeline , err error )
107
+ FindActivePipelineAppIdsByInFilter (envId int , appIdIncludes []int ) ([]int , error )
106
108
FindActiveByNotFilter (envId int , appIdExcludes []int ) (pipelines []* Pipeline , err error )
107
109
FindAllPipelinesByChartsOverrideAndAppIdAndChartId (chartOverridden bool , appId int , chartId int ) (pipelines []* Pipeline , err error )
108
110
FindActiveByAppIdAndPipelineId (appId int , pipelineId int ) ([]* Pipeline , error )
@@ -128,6 +130,7 @@ type PipelineRepository interface {
128
130
FindWithEnvironmentByCiIds (ctx context.Context , cIPipelineIds []int ) ([]* Pipeline , error )
129
131
FindDeploymentAppTypeByAppIdAndEnvId (appId , envId int ) (string , error )
130
132
FindByAppIdToEnvIdsMapping (appIdToEnvIds map [int ][]int ) ([]* Pipeline , error )
133
+ FindDeploymentAppTypeByIds (ids []int ) (pipelines []* Pipeline , err error )
131
134
}
132
135
133
136
type CiArtifactDTO struct {
@@ -483,6 +486,15 @@ func (impl PipelineRepositoryImpl) FindActiveByEnvId(envId int) (pipelines []*Pi
483
486
return pipelines , err
484
487
}
485
488
489
+ func (impl PipelineRepositoryImpl ) FindActivePipelineAppIdsByEnvId (envId int ) ([]int , error ) {
490
+ var appIds []int
491
+ err := impl .dbConnection .Model ((* Pipeline )(nil )).Column ("app_id" ).
492
+ Where ("environment_id = ?" , envId ).
493
+ Where ("deleted = ?" , false ).
494
+ Select (& appIds )
495
+ return appIds , err
496
+ }
497
+
486
498
func (impl PipelineRepositoryImpl ) FindActivePipelineByEnvId (envId int ) (pipelines []* Pipeline , err error ) {
487
499
err = impl .dbConnection .Model (& pipelines ).Column ("pipeline.*" , "App" , "Environment" ).
488
500
Where ("environment_id = ?" , envId ).
@@ -509,6 +521,15 @@ func (impl PipelineRepositoryImpl) FindActiveByInFilter(envId int, appIdIncludes
509
521
return pipelines , err
510
522
}
511
523
524
+ func (impl PipelineRepositoryImpl ) FindActivePipelineAppIdsByInFilter (envId int , appIdIncludes []int ) ([]int , error ) {
525
+ var appIds []int
526
+ err := impl .dbConnection .Model ((* Pipeline )(nil )).Column ("app_id" ).
527
+ Where ("environment_id = ?" , envId ).
528
+ Where ("app_id in (?)" , pg .In (appIdIncludes )).
529
+ Where ("deleted = ?" , false ).Select (& appIds )
530
+ return appIds , err
531
+ }
532
+
512
533
func (impl PipelineRepositoryImpl ) FindActiveByNotFilter (envId int , appIdExcludes []int ) (pipelines []* Pipeline , err error ) {
513
534
err = impl .dbConnection .Model (& pipelines ).Column ("pipeline.*" , "App" , "Environment" ).
514
535
Where ("environment_id = ?" , envId ).
@@ -812,3 +833,9 @@ func (impl PipelineRepositoryImpl) FindByAppIdToEnvIdsMapping(appIdToEnvIds map[
812
833
Select ()
813
834
return pipelines , err
814
835
}
836
+
837
+ func (impl PipelineRepositoryImpl ) FindDeploymentAppTypeByIds (ids []int ) (pipelines []* Pipeline , err error ) {
838
+ err = impl .dbConnection .Model (& pipelines ).Column ("id" , "app_id" , "env_id" , "deployment_app_type" ).
839
+ Where ("id in (?)" , pg .In (ids )).Where ("deleted = ?" , false ).Select ()
840
+ return pipelines , err
841
+ }
0 commit comments