-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 유저가 참여중인 방 리스트 조회 기능 구현 * refactor: 참여중인 방 조회 기능 수정 * refactor: requestMapping을 이용한 중복 제거
- Loading branch information
1 parent
4d5e866
commit 0ea150d
Showing
26 changed files
with
546 additions
and
461 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
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
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
15 changes: 9 additions & 6 deletions
15
backend/src/main/java/corea/room/dto/RoomCreateRequest.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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
package corea.room.dto; | ||
|
||
import corea.member.domain.Member; | ||
import corea.room.domain.Room; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public record RoomCreateRequest( | ||
String title, | ||
String content, | ||
long memberId, | ||
Member manager, | ||
String repositoryLink, | ||
String thumbnailLink, | ||
int matchingSize, | ||
String keyword, | ||
long currentParticipantsSize, | ||
long limitedParticipantsSize, | ||
LocalDateTime submissionDeadline, | ||
int currentParticipantsSize, | ||
int limitedParticipantsSize, | ||
LocalDateTime recruitmentDeadline, | ||
LocalDateTime reviewDeadline | ||
) { | ||
|
||
//TODO 해당 객체를 사용한다면 반영 | ||
public Room toEntity() { | ||
return null; | ||
return new Room(title, content, matchingSize, | ||
repositoryLink, thumbnailLink, keyword, | ||
currentParticipantsSize, limitedParticipantsSize, manager, | ||
recruitmentDeadline, reviewDeadline); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
package corea.room.dto; | ||
|
||
import corea.room.domain.Room; | ||
|
||
import java.util.List; | ||
|
||
import static java.util.stream.Collectors.collectingAndThen; | ||
import static java.util.stream.Collectors.toList; | ||
|
||
public record RoomResponses(List<RoomResponse> rooms) { | ||
|
||
public static RoomResponses from(List<Room> rooms) { | ||
return rooms.stream() | ||
.map(RoomResponse::from) | ||
.collect(collectingAndThen(toList(), RoomResponses::new)); | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
backend/src/test/java/corea/room/acceptance/RoomAcceptanceTest.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,63 @@ | ||
package corea.room.acceptance; | ||
|
||
import corea.matching.dto.ParticipationRequest; | ||
import corea.matching.service.ParticipationService; | ||
import corea.member.domain.Member; | ||
import corea.member.repository.MemberRepository; | ||
import corea.room.dto.RoomResponse; | ||
import corea.room.dto.RoomResponses; | ||
import corea.room.fixture.MemberFixture; | ||
import corea.room.fixture.RoomFixture; | ||
import corea.room.service.RoomService; | ||
import io.restassured.RestAssured; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.web.server.LocalServerPort; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
class RoomAcceptanceTest { | ||
|
||
@LocalServerPort | ||
int port; | ||
|
||
@Autowired | ||
RoomService roomService; | ||
|
||
@Autowired | ||
MemberRepository memberRepository; | ||
|
||
@Autowired | ||
ParticipationService participationService; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
RestAssured.port = port; | ||
} | ||
|
||
@Test | ||
@DisplayName("현재 로그인한 멤버가 참여 중인 방을 보여준다.") | ||
void participatedRooms() { | ||
Member pororo = memberRepository.save(MemberFixture.MEMBER_PORORO()); | ||
Member ash = memberRepository.save(MemberFixture.MEMBER_ASH()); | ||
RoomResponse roomResponse = roomService.create(RoomFixture.ROOM_CREATE_REQUEST(ash)); | ||
participationService.participate(new ParticipationRequest(roomResponse.id(), pororo.getId())); | ||
|
||
RoomResponses response = RestAssured.given().log().all() | ||
.header("Authorization", "[email protected]") | ||
.when().get("/rooms/participated") | ||
.then().log().all() | ||
.statusCode(200) | ||
.extract().as(RoomResponses.class); | ||
|
||
List<RoomResponse> rooms = response.rooms(); | ||
assertThat(rooms).hasSize(1); | ||
assertThat(rooms.get(0).author()).isEqualTo("박민아"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/test/java/corea/room/fixture/MemberFixture.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,14 @@ | ||
package corea.room.fixture; | ||
|
||
import corea.member.domain.Member; | ||
|
||
public class MemberFixture { | ||
|
||
public static Member MEMBER_PORORO() { | ||
return new Member("jcoding-play", null, "조경찬", "[email protected]", true, 5f); | ||
} | ||
|
||
public static Member MEMBER_ASH() { | ||
return new Member("ashsty", null, "박민아", null, false, 1.5f); | ||
} | ||
} |
Oops, something went wrong.