-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from jisung-in/feature/33-talkroom-findOne-api
[Feature] TalkRoom 단건 조회 API 구현
- Loading branch information
Showing
11 changed files
with
342 additions
and
81 deletions.
There are no files selected for viewing
This file contains 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 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 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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/jisungin/application/talkroom/response/TalkRoomFindOneResponse.java
This file contains 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,43 @@ | ||
package com.jisungin.application.talkroom.response; | ||
|
||
import com.querydsl.core.annotations.QueryProjection; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class TalkRoomFindOneResponse { | ||
|
||
private Long talkRoomId; | ||
private String userName; | ||
private String title; | ||
private String content; | ||
private String bookName; | ||
private String bookImage; | ||
private List<TalkRoomQueryReadingStatus> readingStatuses = new ArrayList<>(); | ||
private List<TalkRoomQueryComments> comments = new ArrayList<>(); | ||
|
||
@Builder | ||
@QueryProjection | ||
public TalkRoomFindOneResponse(Long talkRoomId, String userName, String title, String content, String bookName, | ||
String bookImage) { | ||
this.talkRoomId = talkRoomId; | ||
this.userName = userName; | ||
this.title = title; | ||
this.content = content; | ||
this.bookName = bookName; | ||
this.bookImage = bookImage; | ||
} | ||
|
||
public void addTalkRoomStatus(List<TalkRoomQueryReadingStatus> readingStatuses) { | ||
this.readingStatuses = readingStatuses; | ||
} | ||
|
||
public void addTalkRoomComments(List<TalkRoomQueryComments> comments) { | ||
this.comments = comments; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/jisungin/application/talkroom/response/TalkRoomQueryComments.java
This file contains 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,24 @@ | ||
package com.jisungin.application.talkroom.response; | ||
|
||
import com.querydsl.core.annotations.QueryProjection; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class TalkRoomQueryComments { | ||
|
||
private Long commentId; | ||
private String userName; | ||
private String content; | ||
|
||
@Builder | ||
@QueryProjection | ||
public TalkRoomQueryComments(Long commentId, String userName, String content) { | ||
this.commentId = commentId; | ||
this.userName = userName; | ||
this.content = content; | ||
} | ||
|
||
} |
This file contains 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 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 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 com.jisungin; | ||
|
||
import com.jisungin.config.QueryDslConfig; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.context.annotation.Import; | ||
|
||
@DataJpaTest | ||
@Import(QueryDslConfig.class) | ||
public abstract class RepositoryTestSupport { | ||
|
||
} |
This file contains 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 |
---|---|---|
|
@@ -174,49 +174,18 @@ void getTalkRoomsEmpty() throws Exception { | |
.andExpect(jsonPath("$.message").value("OK")); | ||
} | ||
|
||
// private void createTalkRoomRole(TalkRoom talkRoom) { | ||
// List<String> request = new ArrayList<>(); | ||
// request.add("읽는 중"); | ||
// request.add("읽음"); | ||
// | ||
// List<ReadingStatus> readingStatus = ReadingStatus.createReadingStatus(request); | ||
// | ||
// readingStatus.stream().map(status -> TalkRoomRole.roleCreate(talkRoom, status)) | ||
// .forEach(talkRoomRoleRepository::save); | ||
// } | ||
// | ||
// private static TalkRoom createTalkRoom(Book book, User user) { | ||
// return TalkRoom.builder() | ||
// .book(book) | ||
// .title("토크방") | ||
// .content("내용") | ||
// .user(user) | ||
// .build(); | ||
// } | ||
// | ||
// private static User createUser() { | ||
// return User.builder() | ||
// .name("[email protected]") | ||
// .profileImage("image") | ||
// .oauthId( | ||
// OauthId.builder() | ||
// .oauthId("oauthId") | ||
// .oauthType(OauthType.KAKAO) | ||
// .build() | ||
// ) | ||
// .build(); | ||
// } | ||
// | ||
// private static Book createBook() { | ||
// return Book.builder() | ||
// .title("제목") | ||
// .content("내용") | ||
// .authors("작가") | ||
// .isbn("11111") | ||
// .publisher("publisher") | ||
// .dateTime(LocalDateTime.now()) | ||
// .imageUrl("www") | ||
// .build(); | ||
// } | ||
@Test | ||
@DisplayName("토크방 단건 조회를 한다.") | ||
void findOneTalkRoom() throws Exception { | ||
// when // then | ||
mockMvc.perform(get("/v1/talk-room/1") | ||
.contentType(APPLICATION_JSON) | ||
) | ||
.andDo(print()) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.code").value("200")) | ||
.andExpect(jsonPath("$.status").value("OK")) | ||
.andExpect(jsonPath("$.message").value("OK")); | ||
} | ||
|
||
} |
Oops, something went wrong.