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

[BE] refactor: 초기 데이터 설정시 중복 삽입 방지, 선택지 최대 개수 적용 #405

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

skylar1220
Copy link
Contributor


🚀 어떤 기능을 구현했나요 ?

  • 초기 데이터가 있으면 삽입하지 않는 로직을 추가했습니다.
  • 꼬리질문 객관식 최대 선택 갯수를 3개로 수정했습니다.
  • 꼬리질문 서술형 질문 내용을 수정했습니다. : 위에서 선택한 사항과 관련된 경험을 구체적으로 적어 주세요.

🔥 어떻게 해결했나요 ?

  • templateRepository에 id가 1인 템플릿이 있으면 DataInitializer 속 로직을 실행하지 않도록 했습니다.

📝 어떤 부분에 집중해서 리뷰해야 할까요?

  • 위의 방법으로 중복을 방지했을 때 발생할만한 문제가 있는지 봐주세요!

📚 참고 자료, 할 말

Copy link

github-actions bot commented Aug 17, 2024

Test Results

48 tests   48 ✅  2s ⏱️
18 suites   0 💤
18 files     0 ❌

Results for commit 3cae680.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@Kimprodp Kimprodp left a comment

Choose a reason for hiding this comment

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

작은 의견과 함께 approve

@@ -37,10 +39,15 @@ public class DatabaseInitializer {
@PostConstruct
@Transactional
void setup() {
// 템플릿이 이미 존재하면 종료
if (templateRepository.existsById(1L)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

기본으로 사용할 템플릿이 추후 변경될 것을 고려하여 id를 상수로 빼서 관리하는 것은 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#405 (comment)
산초의 피드백으로 적용해보려고해요!

@donghoony donghoony changed the title [BE] refactor: 초기 데이터 설정시 중복 삽입 방지, 선택지 최대 갯수 적용 [BE] refactor: 초기 데이터 설정시 중복 삽입 방지, 선택지 최대 개수 적용 Aug 17, 2024
Copy link
Contributor

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

짱짱~ 고민을 많아 하셨네요☺️

Comment on lines +29 to +31
private static final String CATEGORY_TEXT_QUESTION = "위에서 선택한 사항과 관련된 경험을 구체적으로 적어 주세요.";
private static final int KEYWORD_CHECKBOX_MIN_COUNT = 1;
private static final int KEYWORD_CHECKBOX_MAX_COUNT = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

아주 좋아용☺️

@@ -37,10 +39,15 @@ public class DatabaseInitializer {
@PostConstruct
@Transactional
void setup() {
// 템플릿이 이미 존재하면 종료
if (templateRepository.existsById(1L)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[테드 의견도 좋고 그냥 말해보는 의견]
요 부분은 templateRepository.findAll().size() > 1 이렇게 가져가도 좋을 것 같아요 ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오오 좋습니다! 반영 완료!

@skylar1220 skylar1220 merged commit a7224c0 into develop Aug 19, 2024
2 checks passed
@donghoony donghoony deleted the be/refactor/314-initial-data-check-box-max-count branch August 19, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BE] 초기 데이터 설정시 중복 삽입 방지, 선택지 최대 갯수 적용
4 participants