Skip to content

Conversation

@jhnyuk
Copy link
Collaborator

@jhnyuk jhnyuk commented Dec 16, 2023

구현 내용

  • 인메모리 데이터베이스 구현
  • 할 일 API 구현
  • 할 일 테스트 케이스 작성

변경 사항

비고

@jhnyuk jhnyuk self-assigned this Dec 16, 2023
private Long id;
private LocalDateTime createDate;
private LocalDateTime modifyDate;
private Boolean isDeleted;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

무엇을 위한 필드값인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵! 네 개 중 어떤 필드를 말씀하신 걸까요 ??
우선 생성일자랑 수정일자, 삭제 여부를 위한 필드값입니다 !

return of(resultCode, msg, null);
}

public static <T> RsData<T> successOf(T data) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여러 case를 위해 of를 별도로 두신걸로 보이는데, code는 에러 코드만 전달하는 요구사항이었던것 같은데 어떻게 생각하시나요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 맞네요..! 이 부분은 제가 요구사항을 제대로 구현하지 못한 것 같습니다
에러 코드만 전달하도록 수정하겠습니다 !


@RestControllerAdvice
public class GlobalExceptionHandler {
private static final String INVALID_KEY_VALUE = "키 값이 유효하지 않습니다.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Property클래스들을 별도의 Enum으로 관리하는 편이 좋지않았을까요?


@GetMapping("/{id}")
public RsData<ViewSingleResponse> getSingleTodo(@PathVariable("id") Long id) {
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try-catch를 controller에서 처리한 이유가 따로있나요?

import java.util.stream.Collectors;

@Component
public class InMemoryDB<K, V> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K,V로 처리한건 아주 좋은 방법인것같네요 배워갑니다

this.deleted = todo.isDeleted();
}

public Long getId() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getter어노테이션 사용후 별도로 getter를 구현하신이유가 있나요?


import study.todolist.domain.todo.util.Priority;

public class ViewAllResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

record 타입을 고려안하신이유가 있나요?


@Service
@RequiredArgsConstructor
public class TodoServiceImpl implements TodoService {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DIP 적용하신거 좋네요

@Override
public List<ViewSingleResponse> getAllTodos() {
return inMemoryDB.findAll().stream()
.filter(todo -> !todo.isDeleted())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지원진 ToDo값은 null이 포함되기에 작성한 로직인가요?

@@ -0,0 +1,5 @@
package study.todolist.domain.todo.util;

public enum Priority {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

무슨 속성을 위한 값인가요?

public boolean isFail() {
return !isSuccess();
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 형식으로 작성하는군요!
감사합니다! 배워갈게요😊

public int hashCode() {
return Objects.hash(task);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유효성처리에 대한 고민이 있었는데, 해소가 되네요!
저라면 단순 자료형으로 필드를 구성하고 Service단에서 처리했을 것 같은데,
이렇게 사용할 수도 있겠구나 라는 생각을 하게 됩니다!
시야가 넓어지는 느낌이네요 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants