-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dad9e96
commit 2dfc5cb
Showing
7 changed files
with
58 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...s/src/main/java/io/flowinquiry/modules/usermanagement/service/event/CreatedUserEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.flowinquiry.modules.usermanagement.service.event; | ||
|
||
import io.flowinquiry.modules.usermanagement.service.dto.UserDTO; | ||
import lombok.Getter; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
@Getter | ||
public class CreatedUserEvent extends ApplicationEvent { | ||
private UserDTO user; | ||
|
||
public CreatedUserEvent(Object source, UserDTO user) { | ||
super(source); | ||
this.user = user; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...java/io/flowinquiry/modules/usermanagement/service/listener/CreatedUserEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.flowinquiry.modules.usermanagement.service.listener; | ||
|
||
import io.flowinquiry.modules.collab.service.MailService; | ||
import io.flowinquiry.modules.usermanagement.service.event.CreatedUserEvent; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Component | ||
public class CreatedUserEventListener { | ||
|
||
private final MailService mailService; | ||
|
||
public CreatedUserEventListener(MailService mailService) { | ||
this.mailService = mailService; | ||
} | ||
|
||
@Async("auditLogExecutor") | ||
@Transactional | ||
@EventListener | ||
public void onCreatedUserEvent(CreatedUserEvent event) { | ||
mailService.sendCreationEmail(event.getUser()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters