Skip to content

Commit cc50177

Browse files
committed
updating indentation and comment
1 parent 788dc5e commit cc50177

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/appStore/discover/repository/AppStoreApplicationVersionRepository.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func updateFindWithFilterQuery(filter *appStoreBean.AppStoreFilter, updateAction
9999
query = " ch.name as chart_name, das.id as docker_artifact_store_id"
100100
}
101101
}
102-
102+
//for chart repos, created (derived through index.yaml) column of app_store_application_version is used for finding latest version and for oci repo id is used (because created is null)
103103
latestAppStoreVersionQueryForChartRepo := " SELECT MAX(created) as created " +
104104
" FROM app_store_application_version asv " +
105105
" INNER JOIN app_store aps ON (asv.app_store_id = aps.id and aps.active = true and aps.chart_repo_id is NOT NULL) " +
@@ -251,15 +251,19 @@ func (impl *AppStoreApplicationVersionRepositoryImpl) FindLatestVersionByAppStor
251251

252252
func (impl *AppStoreApplicationVersionRepositoryImpl) SearchAppStoreChartByName(chartName string) ([]*appStoreBean.ChartRepoSearch, error) {
253253
var chartRepos []*appStoreBean.ChartRepoSearch
254+
//for chart repos, created (derived through index.yaml) column of app_store_application_version is used for finding latest version and for oci repo id is used (because created is null)
254255
queryTemp := "select asv.id as app_store_application_version_id, asv.version, asv.deprecated, aps.id as chart_id," +
255256
" aps.name as chart_name, chr.id as chart_repo_id, chr.name as chart_repo_name" +
256257
" from app_store_application_version asv" +
257258
" inner join app_store aps on asv.app_store_id = aps.id" +
258259
" left join chart_repo chr on aps.chart_repo_id = chr.id" +
259260
" left join docker_artifact_store das on aps.docker_artifact_store_id = das.id" +
260-
" where aps.name like '%" +
261-
chartName + "%' and" +
262-
" ( ( aps.docker_artifact_store_id is NOT NULL and asv.id = (SELECT MAX(id) FROM app_store_application_version WHERE app_store_id = asv.app_store_id)) or (aps.chart_repo_id is NOT NULL and asv.created = (SELECT MAX(created) FROM app_store_application_version WHERE app_store_id = asv.app_store_id)) ) " +
261+
" where aps.name like '%" + chartName + "%' and" +
262+
"( " +
263+
"( aps.docker_artifact_store_id is NOT NULL and asv.id = (SELECT MAX(id) FROM app_store_application_version WHERE app_store_id = asv.app_store_id))" +
264+
" or " +
265+
"(aps.chart_repo_id is NOT NULL and asv.created = (SELECT MAX(created) FROM app_store_application_version WHERE app_store_id = asv.app_store_id)) " +
266+
") " +
263267
"and aps.active=true order by aps.name asc;"
264268
_, err := impl.dbConnection.Query(&chartRepos, queryTemp)
265269
if err != nil {

0 commit comments

Comments
 (0)