-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] : 가이드 확인 여부를 조회/저장/삭제한다 #300
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
968db36
#299 [feat] : 가이드 확인 여부 저장 API를 구현한다
anxi01 1f0d2e8
#299 [feat] : 가이드 확인 여부 조회 API를 구현한다
anxi01 998cc36
#299 [feat] : 가이드 조회 상태 엔티티 및 레포지토리를 생성한다
anxi01 ab6884b
#299 [feat] : 유저 탈퇴 시, 유저 가이드 상태 데이터를 제거한다
anxi01 af128f2
#299 [feat] : fk인 users_id를 not null로 설정한다
anxi01 c8adde0
#299 [feat] : 요청 값에 null이 들어오지 않도록 validation을 추가한다
anxi01 5009f6a
#299 [fix] : GuideViewStatus의 User와 비교하도록 수정한다
anxi01 0397ff0
#299 [feat] : 예외 케이스 테스트코드 작성한다
anxi01 4b1e54a
#299 [feat] : 가이드 확인 여부 삭제 API를 구현한다
anxi01 b7b2f1c
#299 [refactor] : GuideViewLog로 엔티티명을 변경한다
anxi01 1a3a623
#299 [refactor] : 응답 타입 불일치로 응답 타입을 변경한다
anxi01 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package side.onetime.domain; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import side.onetime.domain.enums.GuideType; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @Getter | ||
| @Table( | ||
| name = "guide_view_status", | ||
| uniqueConstraints = { | ||
| @UniqueConstraint(name = "unique_user_guide_type", columnNames = {"users_id", "guide_type"}) | ||
| } | ||
| ) | ||
| public class GuideViewStatus { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "guide_view_status_id") | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "users_id", foreignKey = @ForeignKey(name = "guide_view_status_fk_users_id"), nullable = false) | ||
| private User user; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "guide_type", nullable = false) | ||
| private GuideType guideType; | ||
|
|
||
| @Column(name = "is_viewed", nullable = false) | ||
| private Boolean isViewed; | ||
|
|
||
| @Column(name = "viewed_at", nullable = false) | ||
| private LocalDateTime viewedAt; | ||
|
|
||
| @Builder | ||
| public GuideViewStatus(User user, GuideType guideType) { | ||
| this.user = user; | ||
| this.guideType = guideType; | ||
| this.isViewed = true; | ||
| this.viewedAt = LocalDateTime.now(); | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package side.onetime.domain.enums; | ||
|
|
||
| public enum GuideType { | ||
|
|
||
| SCHEDULE_GUIDE_MODAL_001, | ||
| ; | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/side/onetime/dto/user/request/CreateGuideViewStatusRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package side.onetime.dto.user.request; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import side.onetime.domain.enums.GuideType; | ||
|
|
||
| @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public record CreateGuideViewStatusRequest( | ||
| @NotNull(message = "가이드 타입은 필수 값입니다.") | ||
| GuideType guideType | ||
| ) { | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/side/onetime/dto/user/response/GetGuideViewStatusResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package side.onetime.dto.user.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
|
||
| @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public record GetGuideViewStatusResponse( | ||
| boolean isViewed | ||
| ) { | ||
| public static GetGuideViewStatusResponse from(boolean isViewed) { | ||
| return new GetGuideViewStatusResponse(isViewed); | ||
| } | ||
| } |
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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/side/onetime/repository/GuideViewStatusRepository.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package side.onetime.repository; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import side.onetime.domain.GuideViewStatus; | ||
| import side.onetime.domain.User; | ||
| import side.onetime.domain.enums.GuideType; | ||
|
|
||
| public interface GuideViewStatusRepository extends JpaRepository<GuideViewStatus, Long> { | ||
|
|
||
| boolean existsByUserAndGuideType(User user, GuideType guideType); | ||
| } |
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
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
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
Oops, something went wrong.
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.
여기에 400 409 예외 처리 테스트 코드도 추가해주시면 좋을 것 같아요~!
제가 이번에 에타 기능 개선하면서 예외 케이스도 테스트 코드로 추가해봤는데 가능하더라구요
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.
400
{ "code": "E_BAD_REQUEST", "message": "올바르지 않은 enum 값입니다. 허용되지 않은 값: SCHEDULE_GUIDE_MODAL_0013232", "is_success": false }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.
409
{ "code": "USER-005", "message": "이미 조회한 가이드입니다.", "is_success": false }