Skip to content

Commit 364520e

Browse files
jreynard-codelalepee
authored andcommitted
Remove findAll call from DatasetServiceImpl.findAllDatasets
Apparently, findAll() implementation of RedisDocumentRepository is buggy in redis-om-spring version 0.6.4. So we for a query to bypass the problem here. We force a filter on organizationId.
1 parent c8f65b3 commit 364520e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dataset/src/integrationTest/kotlin/com/cosmotech/dataset/service/DatasetServiceIntegrationTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class DatasetServiceIntegrationTest : CsmRedisTestBase() {
351351

352352
logger.info("should find all datasets and assert there are $numberOfDatasets")
353353
var datasetList = datasetApiService.findAllDatasets(organizationSaved.id!!, null, null)
354-
assertEquals(numberOfDatasets + 1, datasetList.size)
354+
assertEquals(numberOfDatasets, datasetList.size)
355355

356356
logger.info("should find all datasets and assert it equals defaultPageSize: $defaultPageSize")
357357
datasetList = datasetApiService.findAllDatasets(organizationSaved.id!!, 0, null)
@@ -363,7 +363,7 @@ class DatasetServiceIntegrationTest : CsmRedisTestBase() {
363363

364364
logger.info("should find all solutions and assert it returns the second / last page")
365365
datasetList = datasetApiService.findAllDatasets(organizationSaved.id!!, 1, expectedSize)
366-
assertEquals(numberOfDatasets - expectedSize + 1, datasetList.size)
366+
assertEquals(numberOfDatasets - expectedSize, datasetList.size)
367367
}
368368

369369
@Test

dataset/src/main/kotlin/com/cosmotech/dataset/service/DatasetServiceImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class DatasetServiceImpl(
155155
val currentUser = getCurrentAccountIdentifier(this.csmPlatformProperties)
156156
datasetRepository.findByOrganizationId(organizationId, currentUser, it).toList()
157157
} else {
158-
datasetRepository.findAll(it).toList()
158+
datasetRepository.findByOrganizationIdNoSecurity(organizationId, it).toList()
159159
}
160160
}
161161
} else {
@@ -164,7 +164,7 @@ class DatasetServiceImpl(
164164
val currentUser = getCurrentAccountIdentifier(this.csmPlatformProperties)
165165
datasetRepository.findByOrganizationId(organizationId, currentUser, pageable).toList()
166166
} else {
167-
datasetRepository.findAll(pageable).toList()
167+
datasetRepository.findByOrganizationIdNoSecurity(organizationId, pageable).toList()
168168
}
169169
}
170170
result.forEach { it.security = updateSecurityVisibility(it).security }

0 commit comments

Comments
 (0)