Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ To facilitate this in a decoupled manner, the framework publishes a UserPreDelet

Consuming applications that have extended BaseUserProfile (or have other user-related data) should listen for this event and perform the necessary cleanup operations.

Event Class: com.digitalsanctuary.spring.user.event.UserPreDeleteEvent Event Data: Contains the User entity that is about to be deleted (event.getUser()).
Event Class: com.digitalsanctuary.spring.user.event.UserPreDeleteEvent Event Data: the id and email of the user about to be deleted (`event.getUserId()`, `event.getUserEmail()`). The `User` entity itself is not carried on the event.

Example Event Listener:

Expand Down Expand Up @@ -995,7 +995,7 @@ public class UserProfileDeletionListener {
@EventListener
@Transactional // Joins the transaction started by UserService.deleteUserAccount
public void handleUserPreDelete(UserPreDeleteEvent event) {
Long userId = event.getUser().getId();
Long userId = event.getUserId();
log.info("Received UserPreDeleteEvent for userId: {}. Deleting associated DemoUserProfile...", userId);

// Option 1: Delete profile directly (if no further cascades needed from profile)
Expand Down
Loading