@@ -269,8 +269,14 @@ public ResponseEntity<ProfileResponse> query(@RequestParam(value = "uid", requir
269269 @ PreAuthorize ("hasRole('CRM')" )
270270 public ResponseEntity <Map <String , ConnectionStatusResponse >> connectionStatus (@ RequestBody ConnectionStatus connectionStatus ) {
271271 String crmOrganisationId = connectionStatus .organisationId ();
272+ if (LOG .isDebugEnabled ()) {
273+ LOG .debug (String .format ("/crm/api/v1/profiles for crmOrganisationId %s" , crmOrganisationId ));
274+ }
272275 Optional <Organisation > optionalOrganisation = organisationRepository .findByCrmOrganisationId (crmOrganisationId );
273276 if (optionalOrganisation .isEmpty ()) {
277+ if (LOG .isDebugEnabled ()) {
278+ LOG .debug (String .format ("/crm/api/v1/profiles No organisation found for %s" , crmOrganisationId ));
279+ }
274280 return ResponseEntity .ok (Map .of ());
275281 }
276282 Organisation organisation = optionalOrganisation .get ();
@@ -287,6 +293,9 @@ public ResponseEntity<Map<String, ConnectionStatusResponse>> connectionStatus(@R
287293 CRMStatusCode .Paired .getStatus (), CRMStatusCode .Paired .getStatusCode ()
288294 )
289295 ));
296+ if (LOG .isDebugEnabled ()) {
297+ LOG .debug (String .format ("/crm/api/v1/profiles connectionStatus.connected is true. Returning %s" , responseMap ));
298+ }
290299 return ResponseEntity .ok (responseMap );
291300 } else {
292301 Map <String , ConnectionStatusResponse > responseMap = invitationRepository
@@ -313,6 +322,9 @@ public ResponseEntity<Map<String, ConnectionStatusResponse>> connectionStatus(@R
313322 },
314323 (existing , replacement ) -> replacement
315324 ));
325+ if (LOG .isDebugEnabled ()) {
326+ LOG .debug (String .format ("/crm/api/v1/profiles connectionStatus.connected is false. Returning %s" , responseMap ));
327+ }
316328 return ResponseEntity .ok (responseMap );
317329 }
318330 }
@@ -336,6 +348,9 @@ private CRMStatusCode crmStatusCode(Invitation invitation) {
336348 @ SecurityRequirement (name = API_HEADER_SCHEME_NAME )
337349 @ PreAuthorize ("hasRole('CRM')" )
338350 public ResponseEntity <ResendInvitationResponse > resendInvitation (@ RequestBody ResendInvitation resendInvitation ) {
351+ if (LOG .isDebugEnabled ()) {
352+ LOG .debug (String .format ("/crm/api/v1/invite/resend for %s" , resendInvitation ));
353+ }
339354 List <Invitation > invitations = invitationRepository .findByCrmContactIdAndCrmOrganisationId (resendInvitation .crmContatcId (),
340355 resendInvitation .crmOrganisationId ());
341356 invitations .forEach (invitation -> {
@@ -355,7 +370,11 @@ public ResponseEntity<ResendInvitationResponse> resendInvitation(@RequestBody Re
355370
356371 });
357372 String timestamp = LocalDateTime .now ().format (DateTimeFormatter .ofPattern ("yyyy-MM-dd'T'HH:mm:ss" ));
358- return ResponseEntity .ok (new ResendInvitationResponse (timestamp , 200 , "ok" , "Resend invitation" ));
373+ ResendInvitationResponse response = new ResendInvitationResponse (timestamp , 200 , "ok" , "Resend invitation" );
374+ if (LOG .isDebugEnabled ()) {
375+ LOG .debug (String .format ("/crm/api/v1/invite/resend returning %s" , response ));
376+ }
377+ return ResponseEntity .ok (response );
359378 }
360379
361380 @ PostMapping (value = "/crm/api/v1/invite/remove" , produces = MediaType .APPLICATION_JSON_VALUE )
@@ -391,6 +410,10 @@ public ResponseEntity<String> remove(@RequestBody RemoveRoles removeRoles) {
391410 @ SecurityRequirement (name = API_HEADER_SCHEME_NAME )
392411 @ PreAuthorize ("hasRole('CRM')" )
393412 public ResponseEntity <List <CRMOrganisation >> organisations () {
413+ if (LOG .isDebugEnabled ()) {
414+ LOG .debug ("/crm/api/v1/organisations called" );
415+ }
416+
394417 List <Organisation > organisations = organisationRepository .findByCrmOrganisationIdIsNotNull ();
395418 List <CRMOrganisation > crmOrganisations = organisations .stream ()
396419 .map (organisation -> new CRMOrganisation (
@@ -399,6 +422,9 @@ public ResponseEntity<List<CRMOrganisation>> organisations() {
399422 organisation .getCrmOrganisationName ()
400423 ))
401424 .toList ();
425+ if (LOG .isDebugEnabled ()) {
426+ LOG .debug (String .format ("/crm/api/v1/organisations returning %s" , crmOrganisations ));
427+ }
402428 return ResponseEntity .ok (crmOrganisations );
403429 }
404430
0 commit comments