Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[201800422 정세희] level9 미션 제출합니다. #45

Open
wants to merge 3 commits into
base: level9-initial
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/backend/likelion/todos/todo/TodoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public ResponseEntity<Void> create(
@RequestBody TodoCreateRequest request
) {
// TODO [9단계] TodoCreateRequest에서 goalId, content, date를 추출하여 todoService의 save 메소드를 호출하고, 생성된 Todo의 ID로 URI를 생성하여 ResponseEntity를 반환하세요.
return null;
Long savedUriSring = todoService.save(request.goalId(), memberId, request.content(), request.date());
return ResponseEntity.created(URI.create("/todos/" + savedUriSring)).build();
}

@PostMapping("/{id}/check")
Expand All @@ -38,6 +39,7 @@ public void check(
@PathVariable("id") Long todoId
) {
// TODO [9단계] todoId와 memberId를 todoService의 check 메소드에 전달하여 Todo를 완료 상태로 변경하세요.
todoService.check(todoId, memberId);
}

@PostMapping("/{id}/uncheck")
Expand All @@ -46,6 +48,7 @@ public void uncheck(
@PathVariable("id") Long todoId
) {
// TODO [9단계] todoId와 memberId를 todoService의 uncheck 메소드에 전달하여 Todo를 미완료 상태로 변경하세요.
todoService.uncheck(todoId, memberId);
}

@PutMapping("/{id}")
Expand All @@ -55,6 +58,7 @@ public void update(
@RequestBody TodoUpdateRequest request
) {
// TODO [9단계] TodoUpdateRequest에서 content, date를 추출하고, todoId와 memberId를 함께 todoService의 update 메소드에 전달하여 Todo 정보를 업데이트하세요.
todoService.update(todoId, memberId, request.content(), request.date());
}

@DeleteMapping("/{id}")
Expand All @@ -63,6 +67,7 @@ public void delete(
@PathVariable("id") Long todoId
) {
// TODO [9단계] todoId와 memberId를 todoService의 delete 메소드에 전달하여 Todo를 삭제하세요.
todoService.delete(todoId, memberId);
}

@GetMapping("/my")
Expand All @@ -72,6 +77,6 @@ public ResponseEntity<List<TodoWithDayResponse>> findMine(
@RequestParam(value = "month", required = true) int month
) {
// TODO [9단계] memberId와 YearMonth.of(year, month)를 todoService의 findAllByMemberIdAndDate 메소드에 전달하여 해당 기간의 모든 Todo를 조회하고, 조회된 정보를 ResponseEntity.ok()에 담아 반환하세요.
return null;
return ResponseEntity.ok(todoService.findAllByMemberIdAndDate(memberId, YearMonth.of(year, month)));
}
}