@@ -376,12 +376,14 @@ public ResponseEntity<String> remove(@RequestBody RemoveRoles removeRoles) {
376376 @ SecurityRequirement (name = API_HEADER_SCHEME_NAME )
377377 @ PreAuthorize ("hasRole('CRM')" )
378378 public ResponseEntity <List <CRMOrganisation >> organisations () {
379- List <Organisation > organisations = organisationRepository .findAll ();
380- List <CRMOrganisation > crmOrganisations = organisations .stream ().map (organisation -> new CRMOrganisation (
381- organisation .getCrmOrganisationId (),
382- organisation .getCrmOrganisationAbbrevation (),
383- organisation .getCrmOrganisationName ()
384- )).toList ();
379+ List <Organisation > organisations = organisationRepository .findByCrmOrganisationIdIsNotNull ();
380+ List <CRMOrganisation > crmOrganisations = organisations .stream ()
381+ .map (organisation -> new CRMOrganisation (
382+ organisation .getCrmOrganisationId (),
383+ organisation .getCrmOrganisationAbbrevation (),
384+ organisation .getCrmOrganisationName ()
385+ ))
386+ .toList ();
385387 return ResponseEntity .ok (crmOrganisations );
386388 }
387389
@@ -408,7 +410,7 @@ public ResponseEntity<String> send(@RequestBody SendInvitation sendInvitation) {
408410 }
409411
410412 Organisation organisation = organisationRepository .findByCrmOrganisationId (sendInvitation .crmOrganisationId ())
411- .orElseThrow (() -> new NotFoundException ("Organisation not found: " + sendInvitation .crmOrganisationId ()));
413+ .orElseThrow (() -> new NotFoundException ("Organisation not found: " + sendInvitation .crmOrganisationId ()));
412414 CRMContact crmContact = new CRMContact ();
413415 crmContact .setEmail (sendInvitation .email ());
414416 crmContact .setRoles (sendInvitation .roles ());
0 commit comments