Skip to content

Commit

Permalink
fix/#499: ApplicationEventPublisher 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
LJH098 committed Sep 17, 2024
1 parent 120ff70 commit 04e4cf7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javax.servlet.http.HttpServletRequest;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -32,6 +33,7 @@
@Tag(name = "[몸무게 수정]")
public class UpdateWeightController {
private final UpdateWeightUsecase updateWeightUsecase;
private final ApplicationEventPublisher publisher;

@Operation(summary = "회원 몸무게 및 목표 몸무게 수정", description = "회원 몸무게 및 목표 몸무게를 수정한다.")
@PatchMapping("/members/weight")
Expand All @@ -42,6 +44,7 @@ public ApiResponse<UpdateWeightResponse> updateWeight(
UpdateWeightResponse response =
updateWeightUsecase.execute(
UpdateWeightCommand.of(request.weight(), request.targetWeight(), memberId));
Events.setPublisher(publisher);
Events.raise(
UpdateWeightEvent.from(
memberId, servletRequest.getRequestURI(), LocalDateTime.now()));
Expand Down

0 comments on commit 04e4cf7

Please sign in to comment.