-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: 장소 등록 시 장소 통계와 함께 등록되는 기능 추가 #479
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cda09de
feat: 장소통계 생성 Command DTO 생성
kokodak 2d0d015
feat: 장소 통계 생성 서비스 로직 구현
kokodak 94c533d
feat: 장소 등록에 대한 이벤트 객체 생성
kokodak 186ae32
feat: 장소 등록에 대한 후속 이벤트 핸들러 구현
kokodak b6d16aa
feat: 장소 등록 메서드에 스프링 이벤트 적용
kokodak 015f83d
test: 장소 등록 시, 장소 통계 등록 검증 테스트 추가
kokodak 5e8a0ab
chore: place 패키지와 placestatistics 패키지 통합
kokodak 865fcc9
chore: 병합 충돌 해결
kokodak 472aec6
feat: Transactional 어노테이션 추가
kokodak 7df2b48
chore: 병합 충돌 해결
kokodak bbc44e2
chore: 패키지 import 최적화
kokodak 1f16d81
Merge branch 'dev_backend' of https://github.com/woowacourse-teams/20…
kokodak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/now/naaga/place/domain/PlaceCreateEvent.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,5 @@ | ||
package com.now.naaga.place.domain; | ||
|
||
public record PlaceCreateEvent(Long temporaryPlaceId, | ||
Long placeId) { | ||
} |
23 changes: 23 additions & 0 deletions
23
...w/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.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,23 @@ | ||
package com.now.naaga.placestatistics.application; | ||
|
||
import com.now.naaga.place.domain.PlaceCreateEvent; | ||
import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CreatePlaceStatisticsWithPlaceCreateEventHandler { | ||
|
||
private final PlaceStatisticsService placeStatisticsService; | ||
|
||
public CreatePlaceStatisticsWithPlaceCreateEventHandler(final PlaceStatisticsService placeStatisticsService) { | ||
this.placeStatisticsService = placeStatisticsService; | ||
} | ||
|
||
@EventListener | ||
public void handle(final PlaceCreateEvent placeCreateEvent) { | ||
final Long placeId = placeCreateEvent.placeId(); | ||
final CreatePlaceStatisticsCommand command = new CreatePlaceStatisticsCommand(placeId); | ||
placeStatisticsService.createPlaceStatistics(command); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
...main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.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,4 @@ | ||
package com.now.naaga.placestatistics.application.dto; | ||
|
||
public record CreatePlaceStatisticsCommand(Long placeId) { | ||
} |
21 changes: 21 additions & 0 deletions
21
...now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.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,21 @@ | ||
package com.now.naaga.temporaryplace.application; | ||
|
||
import com.now.naaga.place.domain.PlaceCreateEvent; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class DeleteTemporaryPlaceWithPlaceCreateEventHandler { | ||
|
||
private final TemporaryPlaceService temporaryPlaceService; | ||
|
||
public DeleteTemporaryPlaceWithPlaceCreateEventHandler(final TemporaryPlaceService temporaryPlaceService) { | ||
this.temporaryPlaceService = temporaryPlaceService; | ||
} | ||
|
||
@EventListener | ||
public void handle(final PlaceCreateEvent placeCreateEvent) { | ||
final Long temporaryPlaceId = placeCreateEvent.temporaryPlaceId(); | ||
temporaryPlaceService.deleteById(temporaryPlaceId); | ||
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분에 AWS S3에 저장된 사진 파일의 위치를 이동시키는 부분도 필요하겠습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. S3 가 어떻게 진행되고 있는지 몰라서 어떤 코멘트인지 잘 모르겠습니다 🥲 수정이 필요하다는 의미이신가요? |
||
} | ||
} |
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
49 changes: 34 additions & 15 deletions
49
...d/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
정리 겸 for 채채
Long placeId) // 장소 통계를 만들기 위함
객체를 생성하고, 해당 객체로 이벤트를 발생시킨다
= PlaceCreateEvent()객체가 publish되었을 때, @eventlistener가 붙고 PlaceCreateEvent 매개변수를 갖는 메서드가 실행 되는 듯 함.
장소통계 서비스를 이용한 장소 통계가 생성된다.
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.
한가지 정정하겠습니다!
동시에 실행되지 않습니다. 비동기 이벤트가 아닌, 동기 이벤트이기 때문에 순서대로 실행됩니다 - !