Open
Conversation
1. Diary 엔티티 클래스 수정:
- @PrePersist와 @PreUpdate 메서드를 추가하여 엔티티가 저장되거나 업데이트되기 전에 updatedAt 필드를 자동으로 설정하도록 수정.
- 이 변경 사항은 엔티티가 생성되거나 업데이트될 때마다 updatedAt 필드를 자동으로 갱신하여 데이터베이스와의 일관성을 유지하기 위함입니다.
2. DiaryService 클래스 수정:
- writeDiary 메서드에서 updatedAt 필드를 설정하도록 추가.
- 일기가 처음 작성될 때도 updatedAt 필드가 설정되어야 하므로, 이를 명시적으로 설정하도록 수정하였습니다.
3. DiaryController 클래스 수정:
- 일기 작성 API 엔드포인트(/api/diaries) 구현.
- 일기 수정 API 엔드포인트(/api/diaries/{diaryId}) 구현.
- 사용자 요청에 따라 일기를 작성하고 수정할 수 있는 API 엔드포인트를 제공하여 사용자 인터페이스와의 상호작용을 지원합니다.
4. 테스트:
- curl 명령어를 사용하여 일기 작성 및 수정 테스트 완료.
- 일기 작성 시 일기가 정상적으로 저장되는 것을 확인.
- 일기 수정 시 기존 일기가 정상적으로 업데이트되는 것을 확인.
- 실제 API 호출을 통해 작성 및 수정 기능이 올바르게 동작하는지 검증하였습니다.
일기 작성 및 수정 기능이 정상적으로 동작함을 확인하였습니다.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
일기 작성 및 수정 기능 구현 완료
Diary 엔티티 클래스 수정:
DiaryService 클래스 수정:
DiaryController 클래스 수정:
테스트:
일기 작성 및 수정 기능이 정상적으로 동작함을 확인하였습니다.