diff --git a/backend/src/main/java/com/festago/bookmark/application/SchoolBookmarkV1QueryService.java b/backend/src/main/java/com/festago/bookmark/application/SchoolBookmarkV1QueryService.java index 68f0dace3..65c6f23ed 100644 --- a/backend/src/main/java/com/festago/bookmark/application/SchoolBookmarkV1QueryService.java +++ b/backend/src/main/java/com/festago/bookmark/application/SchoolBookmarkV1QueryService.java @@ -1,6 +1,6 @@ package com.festago.bookmark.application; -import com.festago.bookmark.dto.SchoolBookmarkTotalV1Response; +import com.festago.bookmark.dto.v1.SchoolBookmarkV1Response; import com.festago.bookmark.repository.SchoolBookmarkV1QuerydslRepository; import java.util.List; import lombok.RequiredArgsConstructor; @@ -14,7 +14,7 @@ public class SchoolBookmarkV1QueryService { private final SchoolBookmarkV1QuerydslRepository schoolBookmarkV1QuerydslRepository; - public List findAllByMemberId(Long memberId) { + public List findAllByMemberId(Long memberId) { return schoolBookmarkV1QuerydslRepository.findAllByMemberId(memberId); } } diff --git a/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkTotalV1Response.java b/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkTotalV1Response.java deleted file mode 100644 index f0688c45a..000000000 --- a/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkTotalV1Response.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.festago.bookmark.dto; - -import com.querydsl.core.annotations.QueryProjection; -import java.time.LocalDateTime; - -public record SchoolBookmarkTotalV1Response( - SchoolBookmarkV1Response school, - LocalDateTime bookmarkCreatedAt -) { - - @QueryProjection - public SchoolBookmarkTotalV1Response { - } -} diff --git a/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkV1Response.java b/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkV1Response.java deleted file mode 100644 index 92327a4b6..000000000 --- a/backend/src/main/java/com/festago/bookmark/dto/SchoolBookmarkV1Response.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.festago.bookmark.dto; - -import com.querydsl.core.annotations.QueryProjection; - -public record SchoolBookmarkV1Response( - Long id, - String name, - String logoUrl -) { - - @QueryProjection - public SchoolBookmarkV1Response { - } -} diff --git a/backend/src/main/java/com/festago/bookmark/dto/v1/SchoolBookmarkV1Response.java b/backend/src/main/java/com/festago/bookmark/dto/v1/SchoolBookmarkV1Response.java new file mode 100644 index 000000000..3b9a219e2 --- /dev/null +++ b/backend/src/main/java/com/festago/bookmark/dto/v1/SchoolBookmarkV1Response.java @@ -0,0 +1,15 @@ +package com.festago.bookmark.dto.v1; + +import com.festago.school.dto.v1.SchoolSearchV1Response; +import com.querydsl.core.annotations.QueryProjection; +import java.time.LocalDateTime; + +public record SchoolBookmarkV1Response( + SchoolSearchV1Response school, + LocalDateTime bookmarkCreatedAt +) { + + @QueryProjection + public SchoolBookmarkV1Response { + } +} diff --git a/backend/src/main/java/com/festago/bookmark/presentation/SchoolBookmarkController.java b/backend/src/main/java/com/festago/bookmark/presentation/SchoolBookmarkController.java index 19440642b..9f40b2678 100644 --- a/backend/src/main/java/com/festago/bookmark/presentation/SchoolBookmarkController.java +++ b/backend/src/main/java/com/festago/bookmark/presentation/SchoolBookmarkController.java @@ -2,7 +2,7 @@ import com.festago.auth.annotation.Member; import com.festago.bookmark.application.SchoolBookmarkV1QueryService; -import com.festago.bookmark.dto.SchoolBookmarkTotalV1Response; +import com.festago.bookmark.dto.v1.SchoolBookmarkV1Response; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; @@ -22,7 +22,7 @@ public class SchoolBookmarkController { @GetMapping @Operation(description = "특정한 회원의 학교 북마크 목록을 반환한다", summary = "회원 학교 북마크 목록 조회") - public ResponseEntity> findAllByMemberId(@Member Long memberId) { + public ResponseEntity> findAllByMemberId(@Member Long memberId) { return ResponseEntity.ok(schoolBookmarkV1QueryService.findAllByMemberId(memberId)); } } diff --git a/backend/src/main/java/com/festago/bookmark/repository/SchoolBookmarkV1QuerydslRepository.java b/backend/src/main/java/com/festago/bookmark/repository/SchoolBookmarkV1QuerydslRepository.java index d89aa6d61..e425a6ff1 100644 --- a/backend/src/main/java/com/festago/bookmark/repository/SchoolBookmarkV1QuerydslRepository.java +++ b/backend/src/main/java/com/festago/bookmark/repository/SchoolBookmarkV1QuerydslRepository.java @@ -6,10 +6,10 @@ import com.festago.bookmark.domain.Bookmark; import com.festago.bookmark.domain.BookmarkType; -import com.festago.bookmark.dto.QSchoolBookmarkTotalV1Response; -import com.festago.bookmark.dto.QSchoolBookmarkV1Response; -import com.festago.bookmark.dto.SchoolBookmarkTotalV1Response; +import com.festago.bookmark.dto.v1.QSchoolBookmarkV1Response; +import com.festago.bookmark.dto.v1.SchoolBookmarkV1Response; import com.festago.common.querydsl.QueryDslRepositorySupport; +import com.festago.school.dto.v1.QSchoolSearchV1Response; import java.util.List; import org.springframework.stereotype.Repository; @@ -20,9 +20,9 @@ protected SchoolBookmarkV1QuerydslRepository() { super(Bookmark.class); } - public List findAllByMemberId(Long memberId) { - return select(new QSchoolBookmarkTotalV1Response( - new QSchoolBookmarkV1Response(school.id, school.name, school.logoUrl), bookmark.createdAt)) + public List findAllByMemberId(Long memberId) { + return select(new QSchoolBookmarkV1Response( + new QSchoolSearchV1Response(school.id, school.name, school.logoUrl), bookmark.createdAt)) .from(bookmark) .innerJoin(school).on(school.id.eq(bookmark.resourceId)) .where(bookmark.bookmarkType.eq(BookmarkType.SCHOOL)