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

feat-be(dashboard): 특정 동아리의 대시보드(공고) 생성 API 구현 #215

Merged
merged 34 commits into from
Aug 1, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Original issue description

목적

  1. 기존의 v0.1, v1 버전과 다른 대시보드 생성 기능 구현
  2. 대시보드의 공고 관련된 모든 세부 내용을 포함하여 요청

작업 세부사항

  • API 버전 변경점 적용
  • 대시보드 생성 요청에 필요한 DTO 추가
  • dashboard ERD 변경에 따른 field 추가 및 수정

참고 사항

  • 기존 API 명세에 작성되어있던 Dashboard 생성 API를 제거 및 수정하였습니다.

아래의 별표줄 밑에 요구사항 ID만 작성해주세요. Prefix 금지!


CREATE_DASHBOARD_01

closes #214

@github-actions github-actions bot added backend 백엔드 feature 새로운 기능 labels Jul 31, 2024
@Dobby-Kim Dobby-Kim requested a review from Chocochip101 July 31, 2024 06:39
Copy link
Member

@Chocochip101 Chocochip101 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다, 도비 :)

리뷰 남겼으니 확인해주세요.

@Dobby-Kim Dobby-Kim marked this pull request as ready for review August 1, 2024 03:10
@Dobby-Kim Dobby-Kim added this to the 스프린트 2.0 milestone Aug 1, 2024
…ASHBOARD_01

# Conflicts:
#	backend/src/main/java/com/cruru/DataLoader.java
#	backend/src/main/java/com/cruru/applyform/domain/ApplyForm.java
#	backend/src/main/java/com/cruru/applyform/domain/repository/ApplyFormRepository.java
#	backend/src/main/java/com/cruru/applyform/service/ApplyFormService.java
#	backend/src/main/java/com/cruru/question/domain/Question.java
#	backend/src/main/java/com/cruru/question/domain/QuestionType.java
#	backend/src/main/java/com/cruru/question/exception/QuestionNotFoundException.java
#	backend/src/test/java/com/cruru/applyform/domain/repository/ApplyFormRepositoryTest.java
#	backend/src/test/java/com/cruru/question/domain/repository/QuestionRepositoryTest.java
#	backend/src/test/java/com/cruru/util/fixture/ApplyFormFixture.java
@Dobby-Kim Dobby-Kim marked this pull request as draft August 1, 2024 03:34
@Dobby-Kim Dobby-Kim requested a review from HyungHoKim00 August 1, 2024 03:35
@woowacourse-teams woowacourse-teams deleted a comment from github-actions bot Aug 1, 2024
@Dobby-Kim Dobby-Kim marked this pull request as draft August 1, 2024 03:52
@Dobby-Kim Dobby-Kim marked this pull request as ready for review August 1, 2024 03:52
Copy link
Contributor Author

github-actions bot commented Aug 1, 2024

1722484351.650359

Copy link
Contributor Author

github-actions bot commented Aug 1, 2024

📌 Test Coverage Report

Overall Project 68.9% -0.93%
Files changed 91.92% 🍏

File Coverage
QuestionType.java 100% 🍏
DashboardFacade.java 100% 🍏
QuestionCreateRequest.java 100% 🍏
DashboardController.java 100% 🍏
DashboardCreateRequest.java 100% 🍏
ChoiceService.java 100% 🍏
ChoiceEmptyBadRequestException.java 100% 🍏
ChoiceBadRequestException.java 100% 🍏
DashboardService.java 100% 🍏
ApplyFormService.java 100% 🍏
ApplyFormCreateRequest.java 100% 🍏
ChoiceCreateRequest.java 100% 🍏
QuestionService.java 100% 🍏
ProcessFactory.java 69.57% -30.43%
ApplyForm.java 69.47% 🍏
Choice.java 50.65% 🍏
DataLoader.java 0% -3.95%

Copy link
Contributor

@HyungHoKim00 HyungHoKim00 left a comment

Choose a reason for hiding this comment

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

QuestionServiceTest와 DashboardFacadeTest가 누락된 것 같습니다. 생성해주세요.


@Transactional
public List<Choice> createAll(List<ChoiceCreateRequest> requests, Question question) {
Question targetQuestion = questionRepository.findById(question.getId())
Copy link
Contributor

Choose a reason for hiding this comment

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

savedQuestion을 사용하는데 다시 questionRepository에서 찾아오는 이유가 있나요?

Copy link
Contributor

Choose a reason for hiding this comment

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

여기서는 상위 파사드 서비스에서 savedQuestion을 전달해줬습니다. 일반적인 use case에서 저장되지 않은 Question에 대해 Choice 저장을 시도하는 것을 미연에 방지를 위함입니다.

근데 적어놓고 보니 의도를 위해서는 Question을 파라미터로 받는 것이 아닌 Question Id를 전달받는 것이 나아보입니다

// given
ApplyForm applyForm = createBackendApplyForm();
ApplyForm applyForm = ApplyFormFixture.createBackendApplyForm(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

여기에서만 클래스 명을 명시한 이유가 있나요?

Copy link
Contributor

Choose a reason for hiding this comment

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

제가 작성한 코드에는 모두 가독성을 위해 클래스명을 명시했습니다. 컨벤션에 대해 논의가 필요해보입니다


// when & then
assertAll(() -> {
assertThrows(ChoiceBadRequestException.class,
Copy link
Contributor

Choose a reason for hiding this comment

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

assertJ의 assertThatThrownBy를 사용하지 않으신 이유가 있나요?

Copy link
Contributor

Choose a reason for hiding this comment

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

습관적으로 사용했습니다. 혹시 assertThatThrownBy를 사용해야하는 이유가 있을까요?

@Dobby-Kim Dobby-Kim requested a review from xogns1514 August 1, 2024 06:20
Copy link
Contributor

@xogns1514 xogns1514 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 도비! 의존성 생각하느라 복잡했을것 같네요
간단한 코멘트 남겨두었습니다.

@@ -30,9 +31,10 @@ public class ApplyForm extends BaseEntity {

private String description;

@Setter
Copy link
Contributor

Choose a reason for hiding this comment

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

다른 도메인에서(Process)는 @Setter 를 직접 사용하지 않고 update필드명 으로 메서드명을 지어준 것 같습니다. 이에 대해 혹시 어떻게 생각하시나용?

  1. 하나로 통일하는 것(세터가 필요한 곳에 @Setter 또는 update필드명
  2. 혼용해서 쓰자

Copy link
Contributor

Choose a reason for hiding this comment

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

해당 Process에서는 기존에 존재하는 정보를 '변경'하는 메서드로 update가 맞지만, 생성되기 전까지 Url이 존재하지 않는 이 케이스에 관해서는 setter의 의미가 더 적절한 것 같습니다.
오히려 update의 의미를 가진 메서드를 만들면 URL이 변동 가능성이 있는 field로 받아들여질 것 같습니다.
저는 필요와 의미에 따라 혼용하는 것을 선택할 것 같습니다

Comment on lines +5 to +9
SHORT_ANSWER("SHORT_ANSWER", false),
LONG_ANSWER("LONG_ANSWER", false),
DROPDOWN("DROPDOWN", true),
CHECK_BOX("CHECK_BOX", true),
MULTIPLE_CHOICE("MULTIPLE_CHOICE", true),
Copy link
Contributor

Choose a reason for hiding this comment

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

Enum명과 동일한 string을 추가로 필드로 넣어준 이유가 궁금합니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

valueOf로 우선적으로 사용하였지만, client단에서 전달된 파라미터가 Enum명에 직접적으로 영향을 줄 수도 있어 우선 field로 완충 작용을 위해 적용하였습니다.

Copy link
Contributor

@xogns1514 xogns1514 left a comment

Choose a reason for hiding this comment

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

LGTM

@Chocochip101 Chocochip101 removed their request for review August 1, 2024 07:54

public ApplyForm(
String title, String description, LocalDateTime openDate, LocalDateTime dueDate,
Dashboard dashboard) {
Copy link
Contributor

Choose a reason for hiding this comment

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

개행을 다시 확인해주세요.


import com.cruru.advice.badrequest.BadRequestException;

public class ChoiceEmptyBadRequestException extends BadRequestException {
Copy link
Contributor

Choose a reason for hiding this comment

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

컨벤션에 대해선 추후 논의해봅시다.

Copy link
Contributor

@HyungHoKim00 HyungHoKim00 left a comment

Choose a reason for hiding this comment

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

LGTM~

@Dobby-Kim Dobby-Kim merged commit ac97e15 into be/develop Aug 1, 2024
@Dobby-Kim Dobby-Kim deleted the be-214-CREATE_DASHBOARD_01 branch August 1, 2024 08:31
Chocochip101 pushed a commit that referenced this pull request Aug 12, 2024
authored-by: Do Yeop Kim <113661364+Dobby-Kim@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend 백엔드 feature 새로운 기능
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

4 participants