-
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 10 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,45 @@ | ||
| 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_logs", | ||
| uniqueConstraints = { | ||
| @UniqueConstraint(name = "unique_user_guide_type", columnNames = {"users_id", "guide_type"}) | ||
| } | ||
| ) | ||
| public class GuideViewLog { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "guide_view_logs_id") | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "users_id", foreignKey = @ForeignKey(name = "guide_view_logs_fk_users_id"), nullable = false) | ||
| private User user; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "guide_type", nullable = false) | ||
| private GuideType guideType; | ||
|
|
||
| @Column(name = "viewed_at", nullable = false) | ||
| private LocalDateTime viewedAt; | ||
|
|
||
| @Builder | ||
| public GuideViewLog(User user, GuideType guideType) { | ||
| this.user = user; | ||
| this.guideType = guideType; | ||
| 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/CreateGuideViewLogRequest.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 CreateGuideViewLogRequest( | ||
| @NotNull(message = "가이드 타입은 필수 값입니다.") | ||
| GuideType guideType | ||
| ) { | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/side/onetime/dto/user/response/GetGuideViewLogResponse.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 GetGuideViewLogResponse( | ||
| boolean isViewed | ||
| ) { | ||
| public static GetGuideViewLogResponse from(boolean isViewed) { | ||
| return new GetGuideViewLogResponse(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
15 changes: 15 additions & 0 deletions
15
src/main/java/side/onetime/repository/GuideViewLogRepository.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.repository; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import side.onetime.domain.GuideViewLog; | ||
| import side.onetime.domain.User; | ||
| import side.onetime.domain.enums.GuideType; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface GuideViewLogRepository extends JpaRepository<GuideViewLog, Long> { | ||
|
|
||
| boolean existsByUserAndGuideType(User user, GuideType guideType); | ||
|
|
||
| Optional<GuideViewLog> findByUser(User user); | ||
| } |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.