Skip to content

Commit

Permalink
#776 | Perform Genders existence check specific to org
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Aug 21, 2024
1 parent e8848d5 commit 2ec78cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@RepositoryRestResource(collectionResourceRel = "gender", path = "gender")
public interface GenderRepository extends CHSRepository<Gender>, CustomCHSJpaRepository<Gender, Long>, FindByLastModifiedDateTime<Gender> {
Gender findByName(String name);
Gender findByNameAndOrganisationId(String name, Long organisationId);
Gender findByNameIgnoreCase(String name);

@RestResource(exported = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public void addGroupDashboardJson(ZipOutputStream zos) throws IOException {
}

private void createGender(String genderName, Organisation org) {
if (Objects.nonNull(genderRepository.findByName(genderName))) {
if (Objects.nonNull(genderRepository.findByNameAndOrganisationId(genderName, org.getId()))) {
return;
}
Gender gender = new Gender();
Expand Down

0 comments on commit 2ec78cf

Please sign in to comment.