From ee0e59bd558e3bba4f8bba5c4f00ea8fa83b1152 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 12 Dec 2024 14:50:03 +0100 Subject: [PATCH] fix getListOfContacts if neither caption nor emailAddress is given --- .../hs/office/contact/HsOfficeContactController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java index 64915d31..b45f070c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java @@ -44,9 +44,10 @@ public class HsOfficeContactController implements HsOfficeContactsApi { context.define(currentSubject, assumedRoles); validate("caption, emailAddress").atMaxOne(caption, emailAddress); - final var entities = caption != null - ? contactRepo.findContactByOptionalCaptionLike(caption) - : contactRepo.findContactByEmailAddress(emailAddress); + final var entities = emailAddress != null + ? contactRepo.findContactByEmailAddress(emailAddress) + : contactRepo.findContactByOptionalCaptionLike(caption); + final var resources = mapper.mapList(entities, HsOfficeContactResource.class); return ResponseEntity.ok(resources);