Skip to content

(김기현) Todo 일기 작성하기 (Side-Project) 리뷰 부탁드립니다.#2

Open
Duskafka wants to merge 63 commits intokihyun/mainfrom
kihyun/diary-project
Open

(김기현) Todo 일기 작성하기 (Side-Project) 리뷰 부탁드립니다.#2
Duskafka wants to merge 63 commits intokihyun/mainfrom
kihyun/diary-project

Conversation

@Duskafka
Copy link

@Duskafka Duskafka commented Feb 3, 2023

No description provided.

Copy link
Member

@DongGeon0908 DongGeon0908 left a comment

Choose a reason for hiding this comment

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

현재 Todo는 titler과 content만으로 구분되고 있는데요!
어떤 날짜에 어떤 todo 목록들이 있고, 이걸 관리하는 기능을 새롭게 구현해보는 건 어떨까요?

Copy link
Member

@DongGeon0908 DongGeon0908 left a comment

Choose a reason for hiding this comment

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

수정수정

}

@ApiOperation(value = "Diary 단건 조회하기")
@GetMapping("/search/single/{id}")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@GetMapping("/search/single/{id}")
@GetMapping("/{id}")

}

@ApiOperation(value = "Diary 범위 조회")
@GetMapping("/search/month/{month}")
Copy link
Member

Choose a reason for hiding this comment

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

이런 경우에는 month를 Request Param으로

}

@ApiOperation(value = "Diary 범위 조회")
@GetMapping("/search/month/{month}")
Copy link
Member

Choose a reason for hiding this comment

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

음 여러 조건으로 검색 기능을 만드신 것 같은데, API를 나누지 말고, 검색 모듈을 만드는게 어떨까요?

}

@ApiOperation(value = "Diary 삭제하기")
@DeleteMapping("/delete/id/{id}")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@DeleteMapping("/delete/id/{id}")
@DeleteMapping("/{id}")

}

@ApiOperation(value = "Diary 수정하기")
@PutMapping("/update/{id}") // @PatchMapping
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@PutMapping("/update/{id}") // @PatchMapping
@PutMapping("/{id}")

private int day;

@Column(name = "feel")
private Feeling feel;
Copy link
Member

Choose a reason for hiding this comment

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

enumrated 추가해야 될 것 같은데요?

public void monthDelete(int month) {
List<Long> deleteId = new LinkedList<>();

diaryRepository.findAll().forEach(eachDiary -> {
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
Author

Choose a reason for hiding this comment

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

해보겠습니다

Copy link
Member

Choose a reason for hiding this comment

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

특정달에 대한 데이터를 삭제하는 쿼리를 만들어서 진행하는 건 어떨까요?
예시는
deletebydatetimebetween...

Comment on lines +68 to +77
@Transactional(readOnly = true)
public Page<DiaryResponse> getRange(Pageable pageable, int month) {
log.info("Todo 범위 조회");
Page<DiaryResponse> allPage = diaryRepository.findAll(pageable).map(DiaryResponse::from);
List<DiaryResponse> middleProcess = allPage.stream().filter(a -> a.getMonth() == month).collect(Collectors.toList());
PageRequest pageRequest = PageRequest.of(0, 10);
int start = (int) pageRequest.getOffset();
int end = Math.min((start + pageRequest.getPageSize()), middleProcess.size());
return new PageImpl<>(middleProcess.subList(start, end), pageRequest, middleProcess.size());
}
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
Author

Choose a reason for hiding this comment

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

해보겠습니다

Copy link
Member

@DongGeon0908 DongGeon0908 left a comment

Choose a reason for hiding this comment

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

확인 부탁드려요


@Api(tags = {"Diary API"})
@RestController
@RequestMapping(value = "/api/v1/Diarys/default", produces = MediaType.APPLICATION_JSON_VALUE)
Copy link
Member

Choose a reason for hiding this comment

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

default는 왜 필요해요??

Copy link
Member

Choose a reason for hiding this comment

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

REST API

  • POST : /api/v1/diaries
  • GET : /api/v1/diaries
  • GET : /api/v1/diaries/{id}
  • PUT : /api/v1/diaries/{id}
  • DELETE : /api/v1/diaries/{id}

이 형태 아닌가요?
그리고 url path에 왜 대문자가 들어가는걸까용?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants