Skip to content

Feat/23 implement Bookmark #28

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

Merged
merged 17 commits into from
Jul 20, 2023
Merged

Feat/23 implement Bookmark #28

merged 17 commits into from
Jul 20, 2023

Conversation

ParkJeongseop
Copy link
Collaborator

@ParkJeongseop ParkJeongseop commented Jul 12, 2023

What is this PR?

Key Changes

  • 북마크 기본 구조 구성

Test Checklist

controller

  • BookmarkContoller.addBookmark(...)는 bookmarkService.create(...)를 호출해야 하고 정상적으로 호출되면 201 CREATED를 반환한다.
  • BookmarkContoller.getBookmarks()는 bookmarkService.getList()를 호출해야 한다.
  • BookmarkContoller.getBookmark(id)는 bookmarkService.get(id)를 호출해야하고 정상적으로 호출되면 200 OK를 반환한다.
  • BookmarkContoller.deleteBookmark(id)는 bookmarkService.delete(id)를 호출해야하고 정상적으로 호출되면 204 NO CONTENT를 반환한다.

service

  • bookmarkService.getList()는 repository.findAll()을 호출한다.
  • bookmarkService.getList()는 [] (빈 리스트)를 반환한다.
  • bookmarkService.get(id)는 repository.findByIdOrNull(id)을 호출한다.
  • bookmarkService.create(...)는 repository.save(...)을 호출한다.
  • bookmarkService.delete(id)는 repository.deleteById(id)을 호출한다.

repository

  • bookmarkRepository.save(...)는 DB에 요청한 데이터를 생성하고 생성된 객체를 반환한다.
  • bookmarkRepository.findByIdOrNull(id)는 DB에서 id로 데이터를 검색하고 검색된 객체를 반환한다.
  • bookmarkRepository.deleteById(id)는 DB에서 id로 데이터를 삭제한다.
  • bookmarkRepository.findAll()는 DB에서 전체 데이터를 반환한다.

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Patch coverage: 81.57% and project coverage change: +21.73 🎉

Comparison is base (09af32c) 50.00% compared to head (b075b3f) 71.73%.

Additional details and impacted files
@@              Coverage Diff              @@
##               main      #28       +/-   ##
=============================================
+ Coverage     50.00%   71.73%   +21.73%     
- Complexity        2       22       +20     
=============================================
  Files             2        7        +5     
  Lines             8       46       +38     
  Branches          0        1        +1     
=============================================
+ Hits              4       33       +29     
- Misses            4       13        +9     
Impacted Files Coverage Δ
...otlin/com/group4/ticketingservice/config/Config.kt 0.00% <0.00%> (ø)
.../ticketingservice/controller/BookmarkController.kt 85.71% <85.71%> (ø)
...com/group4/ticketingservice/dto/BookmarkFromdto.kt 100.00% <100.00%> (ø)
...lin/com/group4/ticketingservice/entity/Bookmark.kt 100.00% <100.00%> (ø)
...group4/ticketingservice/service/BookmarkService.kt 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@junha-ahn junha-ahn assigned bohblue2 and ParkJeongseop and unassigned bohblue2 Jul 12, 2023
@junha-ahn junha-ahn changed the title feat: implement Bookmark Feat/23 implement Bookmark Jul 12, 2023
Copy link
Member

@junha-ahn junha-ahn left a comment

Choose a reason for hiding this comment

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

매우매우 매우 좋습니다 쵝오

@junha-ahn junha-ahn requested review from minjun3021 and yunsuu July 15, 2023 10:44
@junha-ahn
Copy link
Member

junha-ahn commented Jul 15, 2023

추가 테스트 시나리오

  • bookmarkService.getList()가 [] (빈 리스트)을 반환하는지 확인

db mockup으로 가능하다면

  • bookmarkService.create(...)를 호출한 후, 데이터베이스에 해당 북마크가 제대로 저장되었는지 확인. - 북마크를 다시 조회
  • bookmarkService.delete(id)를 호출한 후, 데이터베이스에서 해당 북마크가 제거되었는지 확인합니다. - 북마크를 다시 조회

만약 위 db mockup이 해당 spring boot test에서만 가능하다면 넘어가주시면 됩니다. 해당 #31 이슈와 함께 진행하겠습니다. (해당 사항에 대해서 댓글로 조사한 부분, 의견 알려주세요)

차후 Git issue화 또는 추가 기능

JSON request 지원

@bohblue2
Copy link
Collaborator

bohblue2 commented Jul 15, 2023

잘하셨습니다.

다만 model 폴더를 entity 로 이름을 변경해주세요. 프로젝트 패키지 구조 참조해주세요.

@junha-ahn
Copy link
Member

junha-ahn commented Jul 16, 2023

위 댓글에서 남긴 db mock up 테스트는 @DataJpaTest 어노테이션으로 불가능합니까?

추가로 PR test checklist에 새로 추가한 Test도 포함시켜주세요 (Git issue도 마찬가지)

Copy link
Collaborator

@hihahayoung hihahayoung left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다 ㅎㅎ 역쉬 에이스 JSP!!

@junha-ahn junha-ahn linked an issue Jul 17, 2023 that may be closed by this pull request
@ParkJeongseop
Copy link
Collaborator Author

ParkJeongseop commented Jul 19, 2023

  • 프로젝트 패키지 구조 준수를 위해 model 폴더를 entity 로 이름을 변경
  • DataJpaTest를 이용하여 Repository Test 추가
  • HttpStatus 사용
  • Given-When-Then 주석으로 분리

Copy link
Member

@junha-ahn junha-ahn left a comment

Choose a reason for hiding this comment

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

좋습니다. 계속 좋아지고 있네요! (사실 코딩하시는 기간동안 읽은걸 체크하는거에 가깝네요)

Copy link
Member

@junha-ahn junha-ahn left a comment

Choose a reason for hiding this comment

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

아주 좋습니다! 다음 수정이 마지막일것 같은 예감!


// 북마크 삭제
@DeleteMapping("/{id}")
fun deleteBookmark(@PathVariable id: Long): ResponseEntity<Any> {
Copy link
Member

Choose a reason for hiding this comment

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

entity/Bookmark.kt에서는 INT인데 통일하시는게 좋을것 같습니다.

mysql pk data type에 관련된 정보 함께 학습하셔서 정해주시면 좋을 것 같습니다.

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
Member

Choose a reason for hiding this comment

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

@ParkJeongseop 아래 주제에 대해 생각 남겨주시면 좋을 것 같습니다.

  1. MySQL에서 PK int vs long
  2. (1)에 따른 Kotlin Int vs Long 자료형 표현 범위

Copy link
Collaborator

@bohblue2 bohblue2 left a comment

Choose a reason for hiding this comment

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

Gj!!

Copy link
Member

@junha-ahn junha-ahn left a comment

Choose a reason for hiding this comment

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

GJ

Copy link
Collaborator

@hihahayoung hihahayoung left a comment

Choose a reason for hiding this comment

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

수고수고하셨습니다!!

@junha-ahn junha-ahn merged commit cb39c03 into main Jul 20, 2023
@junha-ahn junha-ahn deleted the feat/23-bookmark branch July 20, 2023 12:04
@junha-ahn junha-ahn mentioned this pull request Jul 23, 2023
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.

공연 북마크 기능 구현
4 participants