-
Notifications
You must be signed in to change notification settings - Fork 0
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: Post Modify 기능 개발 #21
Conversation
Post entity = postRepository.findById(id) | ||
.orElseThrow(() -> new IllegalArgumentException()); | ||
entity.modify(req); | ||
entity.setModifiedAt(LocalDateTime.now()); |
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.
modifiedAt은 @LastModifiedAt이라는 어노테이션을 선언했기에, 이렇게 set 메소드를 쓰지 않아도 자동으로 시간이 업데이트될거라서 안 쓰셔도 될 거에요!
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter |
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.
위의 setModifiedAt은 필요 없어서, setter도 사용 안 하셔도 될 것 같아요!
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.
리뷰 남긴 두 부분만 확인해주시면 될 것 같아요!
DTO를 class로 쓴 부분들은 추후에 record로 리팩토링되는 부분들이라 일단 리뷰 남긴 두 부분만 고치고 진행해도 좋을 것 같습니다!
수고 많으셨어요! 😄
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.
굿굿 지은이 수고했어!!
#️⃣ 연관된 이슈
📝 작업 내용
스크린샷 (선택)
💬 리뷰 요구사항(선택)