Skip to content

Commit 88d22cd

Browse files
committed
Fix: dm path variable 수정 #57
1 parent 370d249 commit 88d22cd

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

src/main/java/com/coastee/server/dmroom/controller/DMRoomController.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.coastee.server.dmroom.dto.DMRoomElements;
88
import com.coastee.server.dmroom.facade.DMRoomFacade;
99
import com.coastee.server.global.apipayload.ApiResponse;
10-
import com.coastee.server.user.facade.UserFacade;
1110
import lombok.RequiredArgsConstructor;
1211
import org.springframework.data.domain.Pageable;
1312
import org.springframework.data.web.PageableDefault;
@@ -20,31 +19,26 @@
2019

2120
@RequiredArgsConstructor
2221
@RestController
23-
@RequestMapping("/api/v1/users/{userId}/dms")
22+
@RequestMapping("/api/v1/dms")
2423
public class DMRoomController {
25-
private final UserFacade userFacade;
2624
private final DMRoomFacade dmRoomFacade;
2725

2826
@GetMapping("")
2927
@UserOnly
3028
public ApiResponse<DMRoomElements> getRooms(
3129
@Auth final Accessor accessor,
32-
@PathVariable("userId") final Long userId,
3330
@PageableDefault(DEFAULT_PAGING_SIZE) final Pageable pageable
3431
) {
35-
userFacade.validateAccess(accessor, userId);
3632
return ApiResponse.onSuccess(dmRoomFacade.getRooms(accessor, pageable));
3733
}
3834

3935
@GetMapping("/{roomId}")
4036
@UserOnly
4137
public ApiResponse<DMElements> getChats(
4238
@Auth final Accessor accessor,
43-
@PathVariable("userId") final Long userId,
4439
@PathVariable("roomId") final Long roomId,
4540
@PageableDefault(DEFAULT_PAGING_SIZE) final Pageable pageable
4641
) {
47-
userFacade.validateAccess(accessor, userId);
4842
return ApiResponse.onSuccess(dmRoomFacade.getChats(accessor, roomId, pageable));
4943
}
5044
}

src/test/java/com/coastee/server/dmroom/controller/DMRoomControllerTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ void getRooms() throws Exception {
8888
.contentType(MediaType.APPLICATION_JSON_VALUE)
8989
.filter(
9090
document("find-all-dmroom",
91-
pathParameters(
92-
parameterWithName("userId").description("유저 아이디")
93-
),
9491
queryParameters(
9592
parameterWithName("page").description("페이지 번호 (default: 0)")
9693
),
@@ -135,7 +132,7 @@ void getRooms() throws Exception {
135132
fieldWithPath("result.dmRoomList[].dm.dmRoomId").type(NUMBER).description("DM의 채팅방 아이디")
136133
)
137134
))
138-
.when().get("/api/v1/users/{userId}/dms", 1)
135+
.when().get("/api/v1/dms")
139136
.then().log().all().statusCode(200);
140137
}
141138

@@ -169,7 +166,6 @@ void getChats() throws Exception {
169166
.filter(
170167
document("find-all-dms",
171168
pathParameters(
172-
parameterWithName("userId").description("유저 아이디"),
173169
parameterWithName("roomId").description("DM 채팅방 아이디")
174170
),
175171
queryParameters(
@@ -205,7 +201,7 @@ void getChats() throws Exception {
205201
fieldWithPath("result.dmList[].dmRoomId").type(NUMBER).description("DM의 채팅방 아이디")
206202
)
207203
))
208-
.when().get("/api/v1/users/{userId}/dms/{roomId}", currentUser.getId(), dmRoom.getId())
204+
.when().get("/api/v1/dms/{roomId}", dmRoom.getId())
209205
.then().log().all().statusCode(200);
210206
}
211207
}

0 commit comments

Comments
 (0)