Skip to content

Commit

Permalink
Merge pull request #13 from virtualidentityag/CARITAS-286-create-new-…
Browse files Browse the repository at this point in the history
…endpoints

feat: CARITAS-286
  • Loading branch information
Leandro13Silva13 authored Nov 8, 2024
2 parents c33ac93 + 24b9f47 commit 62970d6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ List<Agency> searchWithTopic(@Param(value = "postcode") String postCode,
value = SELECT_ALL_AGENCIES_TOPICS
+ ORDER_BY_TOPIC,
nativeQuery = true)
List<Integer> findAllAgenciesTopics();
List<Integer> findAllAgenciesTopics(Long tenantId);

Optional<Agency> findByIdAndDeleteDateNull(Long agencyId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ List<Agency> searchWithTopic(@Param(value = "postcode") String postCode,
+ AND_A_TENANT_ID_FILTER
+ ORDER_BY_TOPIC,
nativeQuery = true)
List<Integer> findAllAgenciesTopics();
List<Integer> findAllAgenciesTopics(Long tenantId);

@Query("select a from Agency as a where a.id = :agencyId ")
Optional<Agency> findById(Long agencyId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ List<Agency> searchWithTopic(@Param(value = "postcode") String postCode,
@Param(value = "gender") String gender,
Long tenantId);

@Query(
value = SELECT_ALL_AGENCIES_TOPICS
+ ORDER_BY_TOPIC,
nativeQuery = true)
List<Integer> findAllAgenciesTopics();

Optional<Agency> findByIdAndDeleteDateNull(Long agencyId);

List<Agency> findByIdIn(List<Long> agencyIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<FullAgencyResponseDTO> getAgencies(String postCode, Integer topicId)
}

public List<Integer> getAgenciesTopics() {
return agencyRepository.findAllAgenciesTopics();
return agencyRepository.findAllAgenciesTopics(TenantContext.getCurrentTenant());
}

private Optional<Integer> getConsultingTypeIdForSearch(int consultingTypeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void getAgencies_Should_searchByTopicId_When_TopicIdProvidedAndFeatureEna
@Test
public void getAgenciesTopics_Should_ReturnListOfTopicIds_When_topicsExist() {

when(agencyRepository.findAllAgenciesTopics())
when(agencyRepository.findAllAgenciesTopics(TenantContext.getCurrentTenant()))
.thenReturn(TOPIC_ID_LIST);

Integer result = agencyService.getAgenciesTopics().get(0);
Expand All @@ -352,7 +352,7 @@ public void getAgenciesTopics_Should_ReturnListOfTopicIds_When_topicsExist() {
@Test
public void getAgenciesTopics_Should_ReturnEmptyListOfTopicIds_When_topicsDontExist() {

when(agencyRepository.findAllAgenciesTopics())
when(agencyRepository.findAllAgenciesTopics(TenantContext.getCurrentTenant()))
.thenReturn(new ArrayList<>());

List<Integer> result = agencyService.getAgenciesTopics();
Expand Down

0 comments on commit 62970d6

Please sign in to comment.