Skip to content

Commit

Permalink
Merge pull request #152 from kakao-tech-campus-2nd-step3/weekly
Browse files Browse the repository at this point in the history
오류 수정
  • Loading branch information
sunandrabbit authored Nov 14, 2024
2 parents 604ac04 + f47f12c commit 027953a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public SingleResult<TaskDetail> getTask(@PathVariable("taskId") Long taskId) {
public PageResult<TaskWithOwnerDetail> getTaskList(@PathVariable("projectId") Long projectId,
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "priority", required = false) String priority,
@RequestParam(value = "owner", required = false) long ownerId,
@RequestParam(value = "owner", required = false) Long ownerId,
@Valid TaskDTO.getList param) {

return PageMapper.toPageResult(
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/team1/be/seamless/init/UserCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public UserCreator(UserService userService) {
}

public void creator() {
userService.createUser(new UserSimple("사용자1", "[email protected]", "user1Image.jpg"));
userService.createUser(new UserSimple("사용자1", "[email protected]", "https://user1Image.jpg"));
userService.createUser(new UserSimple("사용자2", "[email protected]", "https://user2Image.jpg"));
userService.createUser(new UserSimple("사용자3", "[email protected]", "https://user3Image.jpg"));
}
}
12 changes: 5 additions & 7 deletions src/main/java/team1/be/seamless/service/TaskService.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ public TaskDetail getTask(Long taskId) {
return taskMapper.toDetail(taskEntity);
}

public Page<TaskWithOwnerDetail> getTaskList(Long projectId, String status, String priority,
long ownerId, getList param) {
public Page<TaskWithOwnerDetail> getTaskList(Long projectId, String status, String priority, Long ownerId, getList param) {

// MemberEntity memberEntity = memberRepository.findByIdAndIsDeleteFalse(ownerId)
// .orElseThrow(() -> new BaseHandler(HttpStatus.NOT_FOUND, "존재하지 않는 멤버"));

MemberEntity memberEntity = memberRepository.findByIdAndIsDeleteFalse(ownerId)
.orElseThrow(() -> new BaseHandler(HttpStatus.NOT_FOUND, "존재하지 않는 멤버"));

Page<TaskEntity> taskEntities = taskRepository.findByProjectIdAndOptionalFilters(projectId,
status, priority, ownerId, param.toPageable());
Page<TaskEntity> taskEntities = taskRepository.findByProjectIdAndOptionalFilters(
projectId, status, priority, ownerId, param.toPageable());

return new PageImpl<>(
taskEntities.stream()
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/team1/be/seamless/e2e/UserE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import team1.be.seamless.dto.UserDTO.UserUpdate;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.http.HttpMethod.*;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.HttpStatus.*;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class UserE2ETest {
Expand All @@ -40,7 +40,7 @@ public UserE2ETest(TestRestTemplate restTemplate) {
public void setUp() {
HttpEntity<Long> requestEntity = new HttpEntity<>(null);
ResponseEntity<String> responseEntity = restTemplate.exchange(
url + port + "/api/test/userToken/1",
url + port + "/api/test/userToken/2",
POST,
requestEntity, String.class);

Expand Down Expand Up @@ -89,6 +89,7 @@ public void setUp() {
assertThat(responseEntity.getStatusCode()).isEqualTo(OK);
}

@DirtiesContext
@Test
void 유저정보_삭제_실패() {
HttpEntity<Long> requestEntity = new HttpEntity(null, headers);
Expand All @@ -102,6 +103,6 @@ public void setUp() {
requestEntity, String.class);

System.out.println(responseEntity);
assertThat(responseEntity.getStatusCode()).isEqualTo(BAD_REQUEST);
assertThat(responseEntity.getStatusCode()).isEqualTo(NOT_FOUND);
}
}

0 comments on commit 027953a

Please sign in to comment.