-
Notifications
You must be signed in to change notification settings - Fork 1
[DPMBE-60] 이미지 업로드 성공을 요청받고 Picture Enevt를 생성한다 #70
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
Conversation
val imageUrl = IMAGE_DOMAIN + "promise/$promiseId/$imageKey" | ||
val picture = Picture(userId, promiseId, imageUrl, imageKey) |
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.
imageUrl을 생성해서 엔티티에 저장하고있는데, 로컬이나 dev환경에서는 이미지를 확인할 수 없는 문제가있는데 괜찮을까요?
나중에 조회쪽 로직에서 링크를 만들어서 주는게 더 좋을까용
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.
구웃
val pictureRepository: PictureRepository, | ||
) { | ||
fun save(userId: Long, promiseId: Long, imageKey: String) { | ||
val imageUrl = IMAGE_DOMAIN + "promise/$promiseId/$imageKey" | ||
val picture = Picture(userId, promiseId, imageUrl, imageKey) | ||
pictureRepository.save(picture) | ||
} | ||
} |
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.
음
val imageUrl = IMAGE_DOMAIN + "promise/$promiseId/$imageKey"
val picture = Picture(userId, promiseId, imageUrl, imageKey)
요단계는 도메인 서비스로 빠지는게 좋을것 같아요!
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.
네넴 서비스에 있는게 맞겠네용
) : BaseTimeEntity() { | ||
@PostPersist | ||
fun createPictureEvent() { | ||
Events.raise(PictureRegisterEvent(userId, promiseId)) | ||
} | ||
} |
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.
요거근데 이벤트에 id 값도 넣어져서 잘가나유?
picture id 를 안보내서 괜찮은건감
- 도메인 이벤트 발행되었는지 두둥에서 테스트한 방법 공유드려요!
- 함해보심 좋을듯
https://github.com/Gosrock/DuDoong-Backend/blob/f0378ecebd0b6bcc47d846d77052b07051679d23/DuDoong-Domain/src/test/java/band/gosrock/domain/domain/user/service/RegisterUserEventHandlerTest.java
아밑에 리스너 달아놓으셨구나
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.
도메인 이벤트 발행되었는지 테스트 코드도 추가해놓을게용
import org.springframework.transaction.event.TransactionPhase | ||
import org.springframework.transaction.event.TransactionalEventListener | ||
|
||
@Component |
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.
Handler 어노테이션 만들어놓긴했는데
제 지금 피알 이후나중에 함 바꿔주셔유
@Operation(summary = "약속 관련 이미지 업로드 성공 요청") | ||
@PostMapping("/promises/{promiseId}/images/success/{imageKey}") | ||
fun successUploadImage(@PathVariable promiseId: Long, @PathVariable imageKey: String) { | ||
successUseCase.successUploadImage(promiseId, imageKey) | ||
} |
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.
이미지 업로드 작업을 클라이언트쪽에서 하기때문에 (presignedurl을 통해)
따로 핸들링 할 필요는 없슴니닷!
ex) 클라이언트가 presignedUrl을 통해 이미지 업로드 과정에서 실패 -> Url 재발급 하여 다시 업로드 또는 에러처리
Kudos, SonarCloud Quality Gate passed! |
개요
작업사항
변경로직