-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔀::WebHook 로직 추가 #235
🔀::WebHook 로직 추가 #235
Conversation
@@ -46,7 +48,7 @@ class SignUpService( | |||
val savedUser = userRepository.save(user) | |||
|
|||
saveUserRole(user) | |||
|
|||
webHookService.callEvent(user.email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service라는 명칭과 메서드를 직접 호출하는 것 보다는 ApplicationEventPublisher를 이용하는게 어떨까요
@Configuration | ||
class WebHookConfiguration { | ||
|
||
@Bean | ||
fun webHookService(): WebHookService { | ||
return WebHookService() | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 빈 등록을 하는 것 보다는 빈 등록하고싶은 클래스에 @component 어노테이션을 붙이면 빈 등록이 자동으로 됩니당
src/main/resources/application.yml
Outdated
@@ -41,6 +41,9 @@ spring: | |||
max-file-size: ${MAX_FILE_SIZE} | |||
max-request-size: ${MAX_REQUEST_SIZE} | |||
|
|||
discord: | |||
webhookURL: ${SIGNUP_URL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
환경변수 이름이 SIGNUP_URL이 적절한건지 궁금해요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36a6736 이름이 맞지않는 거 같아 수정하였습니다!
src/main/resources/application.yml
Outdated
@@ -41,6 +41,9 @@ spring: | |||
max-file-size: ${MAX_FILE_SIZE} | |||
max-request-size: ${MAX_REQUEST_SIZE} | |||
|
|||
discord: | |||
webhookURL: ${SIGNUP_URL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에 정의되어있는 property들이 max-file-size
같이 dash case인지라 webhookURL보다는 webhook_url 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36a6736 좋은 거 같습니다. 반영하여 수정하였습니다!
class AuthEventHandler( | ||
private val discordProperties: DiscordProperties | ||
) { | ||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어차피 로깅용이면 트랜잭션 이벤트 리스너가 아니라 그냥 이벤트 리스너써서 함수 호출됐을때 실행되도록 하면 될 것 같네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7d401de
참고해서 수정했습니다!
val restTemplate = RestTemplate() | ||
val entity = HttpEntity(jsonObject.toString(), headers) | ||
restTemplate.postForObject(discordProperties.url, entity, String::class.java) | ||
println("3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print 다 찍었으면 지워주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7d401de
깜박하고 지우지 않은거같아요 수정했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어요
💡 개요
회원가입을 하면 디스코드 웹훅을 이용하여 회원가입을 시도한 유저의 email과 함께 웹훅을 보내는 기능
📃 작업내용