@@ -116,10 +116,10 @@ func (impl AppListingRepositoryImpl) FetchJobs(appIds []int, statuses []string,
116116 if len (appIds ) == 0 {
117117 return jobContainers , nil
118118 }
119- jobsQuery := impl .appListingRepositoryQueryBuilder .BuildJobListingQuery (appIds , statuses , environmentIds , sortOrder )
119+ jobsQuery , jobsQueryParams := impl .appListingRepositoryQueryBuilder .BuildJobListingQuery (appIds , statuses , environmentIds , sortOrder )
120120
121121 impl .Logger .Debugw ("basic app detail query: " , jobsQuery )
122- _ , appsErr := impl .dbConnection .Query (& jobContainers , jobsQuery )
122+ _ , appsErr := impl .dbConnection .Query (& jobContainers , jobsQuery , jobsQueryParams ... )
123123 if appsErr != nil {
124124 impl .Logger .Error (appsErr )
125125 return jobContainers , appsErr
@@ -220,10 +220,10 @@ func (impl AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter h
220220
221221 if string (appListingFilter .SortBy ) == helper .LastDeployedSortBy {
222222
223- query := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForLastDeployedSearch (appListingFilter )
223+ query , queryParams := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForLastDeployedSearch (appListingFilter )
224224 impl .Logger .Debug ("GetAppIdsQueryWithPaginationForLastDeployedSearch query " , query )
225225 start := time .Now ()
226- _ , err := impl .dbConnection .Query (& lastDeployedTimeDTO , query )
226+ _ , err := impl .dbConnection .Query (& lastDeployedTimeDTO , query , queryParams ... )
227227 middleware .AppListingDuration .WithLabelValues ("getAppIdsQueryWithPaginationForLastDeployedSearch" , "devtron" ).Observe (time .Since (start ).Seconds ())
228228 if err != nil || len (lastDeployedTimeDTO ) == 0 {
229229 if err != nil {
@@ -238,9 +238,9 @@ func (impl AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter h
238238 appIdsFound [i ] = obj .AppId
239239 }
240240 appListingFilter .AppIds = appIdsFound
241- appContainerQuery := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainerss (appListingFilter )
242- impl .Logger .Debug ("GetQueryForAppEnvContainerss query " , query )
243- _ , err = impl .dbConnection .Query (& appEnvContainer , appContainerQuery )
241+ appContainerQuery , appContainerQueryParams := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
242+ impl .Logger .Debug ("GetQueryForAppEnvContainers query " , query )
243+ _ , err = impl .dbConnection .Query (& appEnvContainer , appContainerQuery , appContainerQueryParams ... )
244244 if err != nil {
245245 impl .Logger .Errorw ("error in getting appEnvContainers with appList filter from db" , "err" , err , "filter" , appListingFilter , "query" , appContainerQuery )
246246 return appEnvArr , appsSize , err
@@ -250,10 +250,10 @@ func (impl AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter h
250250
251251 // to get all the appIds in appEnvs allowed for user and filtered by the appListing filter and sorted by name
252252 appIdCountDtos := make ([]* bean.AppEnvironmentContainer , 0 )
253- appIdCountQuery := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForAppNameSearch (appListingFilter )
253+ appIdCountQuery , appIdCountQueryParams := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForAppNameSearch (appListingFilter )
254254 impl .Logger .Debug ("GetAppIdsQueryWithPaginationForAppNameSearch query " , appIdCountQuery )
255255 start := time .Now ()
256- _ , appsErr := impl .dbConnection .Query (& appIdCountDtos , appIdCountQuery )
256+ _ , appsErr := impl .dbConnection .Query (& appIdCountDtos , appIdCountQuery , appIdCountQueryParams ... )
257257 middleware .AppListingDuration .WithLabelValues ("getAppIdsQueryWithPaginationForAppNameSearch" , "devtron" ).Observe (time .Since (start ).Seconds ())
258258 if appsErr != nil || len (appIdCountDtos ) == 0 {
259259 if appsErr != nil {
@@ -271,10 +271,10 @@ func (impl AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter h
271271 appListingFilter .AppIds = uniqueAppIds
272272 // set appids required for this page in the filter and get the appEnv containers of these apps
273273 appListingFilter .AppIds = uniqueAppIds
274- appsEnvquery := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainerss (appListingFilter )
275- impl .Logger .Debug ("GetQueryForAppEnvContainerss query: " , appsEnvquery )
274+ appsEnvquery , appsEnvQueryParams := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
275+ impl .Logger .Debug ("GetQueryForAppEnvContainers query: " , appsEnvquery )
276276 start = time .Now ()
277- _ , appsErr = impl .dbConnection .Query (& appEnvContainer , appsEnvquery )
277+ _ , appsErr = impl .dbConnection .Query (& appEnvContainer , appsEnvquery , appsEnvQueryParams ... )
278278 middleware .AppListingDuration .WithLabelValues ("buildAppListingQuery" , "devtron" ).Observe (time .Since (start ).Seconds ())
279279 if appsErr != nil {
280280 impl .Logger .Errorw ("error in getting appEnvContainers with appList filter from db" , "err" , appsErr , "filter" , appListingFilter , "query" , appsEnvquery )
0 commit comments