-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature: 배너 이미지 조회 #18
The head ref may contain hidden characters: "16-feature-\uBC30\uB108-\uC774\uBBF8\uC9C0-\uC870\uD68C"
Conversation
- ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가
- only push
8567d37
to
bec1f0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어쁘루브합니다 ApiTestConfig 넘 좋네요 고생하셨습니닷
|
||
@GetMapping | ||
fun readAll(): ResponseEntity<List<BannerResponse>> { | ||
val bannerList = bannerService.readAll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 변수명에 자료형 이름 쓰는 거 허용하시나요
전 좋긴함.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안쓰는게 좋을 것 같아요!
수정하겠습니다~
import org.springframework.boot.test.web.server.LocalServerPort | ||
|
||
@SpringBootTest(webEnvironment = RANDOM_PORT) | ||
abstract class ApiTestConfig : BehaviorSpec() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
조아요~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
최고예요~~
needs: [ build-docker-image-and-push ] | ||
steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
도커 공부 해야하는데 언제하죠ㅋㅋㅋㅎ
val createAt: LocalDateTime, | ||
val updateAt: LocalDateTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createAt, updateAt 도 응답하네요! 클라이언트에게 아마도 필요하지 않을 정보를 응답하는 이유가 궁금합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
문제없는 범위 내에서 createdAt을 자주 응답하긴 했었습니다.. 추후에 추가되는 경우가 종종 있었거든요!
굳이 응답할 필요 없는 것 같은데 제거해두겠습니다~!
|
||
@Cacheable("banners") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
캐시 좋네요! 이거 나중에 레디스로 이사하나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 cacheConfig에서 구현체만 수정하면 될 것 같군요!
레디스를 생각하진 않았는데, 레디스가 도입되면 얘도 거기서 처리하면 되겠네요
package com.petqua.domain.banner | ||
|
||
import com.petqua.common.domain.BaseEntity | ||
import jakarta.persistence.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*
👻 귀신이다아아
When("Banner가 캐싱 되어 있으면") { | ||
repeat(5) { bannerService.getBannerList() } | ||
|
||
Then("퀴리가 발생 하지 않는다") { | ||
verify(bannerRepository, atMost(1)).findAll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
꼼꼼 테스트 좋아요 👍
@SpringBootTest(webEnvironment = RANDOM_PORT) | ||
abstract class ApiTestConfig : BehaviorSpec() { | ||
|
||
@LocalServerPort | ||
protected val port: Int = RestAssured.port | ||
|
||
@Autowired | ||
private lateinit var dataCleaner: DataCleaner | ||
|
||
init { | ||
afterContainer { | ||
dataCleaner.clean() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 너무 좋은데요! 한결 편해질 것 같아요!!!
assertThat(response.statusCode).isEqualTo(HttpStatus.OK.value()) | ||
assertThat(findBannerResponse.size).isEqualTo(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SoftAssertions 안 쓰면 홍고가 화내요ㅠ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이걸 놓쳤네;;;;;;;;;;;
* feat: Banner 도메인 추가 * chore: Spring Cache 설정 추가 * feat: Banner 조회 로직 추가 * feat: Banner 조회 API 추가 * test: Banner Api test 추가 * test: Api test 공통화 * chore: 배포 오류 수정 - ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가 * chore: CI scope 수정 - only push * refactor: Api resource url 수정 * style: method, dto naming 수정 * style: 변수명에 자료형 제거 * refactor: 불필요한 응답 필드 제거 * style: static import 제거 * test: SoftAssertions 적용
* feat: Banner 도메인 추가 * chore: Spring Cache 설정 추가 * feat: Banner 조회 로직 추가 * feat: Banner 조회 API 추가 * test: Banner Api test 추가 * test: Api test 공통화 * chore: 배포 오류 수정 - ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가 * chore: CI scope 수정 - only push * refactor: Api resource url 수정 * style: method, dto naming 수정 * style: 변수명에 자료형 제거 * refactor: 불필요한 응답 필드 제거 * style: static import 제거 * test: SoftAssertions 적용
* feat: Banner 도메인 추가 * chore: Spring Cache 설정 추가 * feat: Banner 조회 로직 추가 * feat: Banner 조회 API 추가 * test: Banner Api test 추가 * test: Api test 공통화 * chore: 배포 오류 수정 - ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가 * chore: CI scope 수정 - only push * refactor: Api resource url 수정 * style: method, dto naming 수정 * style: 변수명에 자료형 제거 * refactor: 불필요한 응답 필드 제거 * style: static import 제거 * test: SoftAssertions 적용
* feat: Banner 도메인 추가 * chore: Spring Cache 설정 추가 * feat: Banner 조회 로직 추가 * feat: Banner 조회 API 추가 * test: Banner Api test 추가 * test: Api test 공통화 * chore: 배포 오류 수정 - ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가 * chore: CI scope 수정 - only push * refactor: Api resource url 수정 * style: method, dto naming 수정 * style: 변수명에 자료형 제거 * refactor: 불필요한 응답 필드 제거 * style: static import 제거 * test: SoftAssertions 적용
* feat: Banner 도메인 추가 * chore: Spring Cache 설정 추가 * feat: Banner 조회 로직 추가 * feat: Banner 조회 API 추가 * test: Banner Api test 추가 * test: Api test 공통화 * chore: 배포 오류 수정 - ddl-auto option으로 table 생성 - docker compose시 이전 Image 삭제 옵션 추가 * chore: CI scope 수정 - only push * refactor: Api resource url 수정 * style: method, dto naming 수정 * style: 변수명에 자료형 제거 * refactor: 불필요한 응답 필드 제거 * style: static import 제거 * test: SoftAssertions 적용
📌 관련 이슈
📁 작업 설명
홈 화면에서 사용 배너 정보를 제공하는 API 개발
Spring Cache
를 통해 배너 정보 caching워크플로우 수정
ddl-auto: create
를 추가하였습니다.💻 미완료 태스크
기타
ApiTestConfig를 추가했습니다! 7c74c6b
공통으로 설정되는 부분들 (`@SpringBootTest(web ..), dataCleaner, afterContainer)을 공통화 해보았습니다.
BehaviorSpec을 상속하는 구조이다 보니, 추가하기 어려웠는데요. 달라진 점은 아래와 같습니다!
AS-IS
TO-BE
ApiTestConfig
에서 BehaviorSpec을 상속해서init{}
depth가 생겼는데요.다들 어떠신가요? 의견에 따라 반영해보겠습니다.
쉽게 롤백하기 위해 커밋을 분리해두었어요!