-
Notifications
You must be signed in to change notification settings - Fork 6
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
+560
−80
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
951a912
Create draft PR for #214
github-actions[bot] 4319876
feat(ApplyForm): 기초 Entity 및 Repository 구현
Dobby-Kim 314654a
style: 컨벤션 미적용 사항 적용
Dobby-Kim 662c654
Revert "style: 컨벤션 미적용 사항 적용"
Dobby-Kim ccad5a2
style: 컨벤션 미적용 사항 적용
Dobby-Kim bf6210b
feat(Question): 질문 유형 ENUM 생성 및 엔티티 적
Dobby-Kim f4db251
feat(Question): 엔티티 field 변경에 따른 toString 수정
Dobby-Kim e62e34b
chore(Question): 생성자 변경에 따른 더미 데이터 수정
Dobby-Kim 810acf1
feat(DTO): 대시보드 생성 요청에 사용되는 DTO 추가
Dobby-Kim 4eba6cc
feat(QuestionType): QuestionType 선택지 존재 여부 field 추가
Dobby-Kim e06b8a0
refactor(Choice): 선택지 순서 field 추가 및 test 수
Dobby-Kim 823e5a7
refactor(DataLoader): ApplyForm 추가에 따른 더미 데이터 저장 코드 추가
Dobby-Kim 06f0a5c
refactor(DashboardCreateRequest): 날짜 Json 파라미터 입력 포맷 설정 및 NotBlack를 N…
Dobby-Kim 6ff67cc
test(ApplicantServiceTest): Question 엔티티 필드 추가에 따른 생성자 수정
Dobby-Kim 656ab1c
feat(Choice): 객관식 질문의 선택지 저장 및 검증 기능 구
Dobby-Kim 592294b
feat(Question): 질문 저장 및 검증 기능 구현
Dobby-Kim f70b6c1
feat(ApplyFormService): 지원서 저장 기능 구현
Dobby-Kim 2b3e13d
feat(DashboardService): 대시보드 초기 프로세스 저장 기능, Dashboard 엔티디 변경에 따른 테스트 …
Dobby-Kim 68dbd96
feat(DashboardFacade): 모집 공고 및 대시보드 생성 기능 소유한 파사드 서비스 생성
Dobby-Kim 0871c77
Merge remote-tracking branch 'origin/be/develop' into be-214-CREATE_D…
Dobby-Kim 3ee4f0e
refactor: conflict 해결 및 import optimized
Dobby-Kim 63fb0ef
refactor(DTO): JsonProperty 세팅
Dobby-Kim 37032b8
refactor(ChoiceException): 예외명 및 스타일 리팩터링
Dobby-Kim 061b55b
refactor(ApplyForm): column명 통일성 적용
Dobby-Kim 2206400
refactor(ApplyFormService): 접근제어자 및 메서드 순서 정렬 변경
Dobby-Kim 0c6684a
refactor(ChoiceRepositoryTest): Choice sequence 0부터 시작하게 test에 사용된 인스…
Dobby-Kim 71acff3
refactor(ChoiceService): Choice 저장 메서드 시그니쳐 변경
Dobby-Kim 6943bbb
refactor(QuestionService): createAll 메서드 생성 및 변경 사항 적용
Dobby-Kim 72fffb9
refactor(DashboardController): 미사용 field 제거
Dobby-Kim 6f1a988
refactor(ApplyFormRepositoryTest): 변경된 field getter명 수정
Dobby-Kim 40573b2
refactor(Question): Question의 선택지 소유 여부 판단 메서드 생성
Dobby-Kim 597bc4a
refactor(ChoiceServiceTest): given 주석 누락 추가 및 assert절 내 사용 변수 추출
Dobby-Kim a3253d4
style(ApplyForm): 코드 컨벤션 적용
Dobby-Kim 415485a
Merge branch 'be/develop' into be-214-CREATE_DASHBOARD_01
Dobby-Kim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/com/cruru/applyform/controller/dto/ApplyFormCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.cruru.applyform.controller.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import java.time.LocalDateTime; | ||
|
||
public record ApplyFormCreateRequest( | ||
@NotBlank(message = "제목은 필수 값입니다.") | ||
String title, | ||
|
||
@JsonProperty("posting_content") | ||
String postingContent, | ||
|
||
@NotBlank(message = "시작 날짜는 필수 값입니다.") | ||
LocalDateTime startDate, | ||
|
||
@NotBlank(message = "종료 날짜는 필수 값입니다.") | ||
LocalDateTime dueDate | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/cruru/choice/controller/dto/ChoiceCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.cruru.choice.controller.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record ChoiceCreateRequest( | ||
@NotBlank(message = "객관식 질문의 선택지는 필수 값입니다.") | ||
String choice, | ||
|
||
@JsonProperty("order_index") | ||
int orderIndex | ||
Dobby-Kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/cruru/choice/exception/ChoiceEmptyBadRequestException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cruru.choice.exception; | ||
|
||
import com.cruru.advice.badrequest.BadRequestException; | ||
|
||
public class ChoiceEmptyBadRequestException extends BadRequestException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 컨벤션에 대해선 추후 논의해봅시다. |
||
|
||
private static final String MESSAGE = "객관식 질문에는 1개 이상의 객관식 선택지를 포함해야합니다."; | ||
|
||
public ChoiceEmptyBadRequestException() { | ||
super(MESSAGE); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/cruru/choice/exception/ChoiceIllegalSaveException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cruru.choice.exception; | ||
|
||
import com.cruru.advice.badrequest.BadRequestException; | ||
|
||
public class ChoiceIllegalSaveException extends BadRequestException { | ||
|
||
private static final String MESSAGE = "선택지를 저장할 수 없는 질문입니다."; | ||
|
||
public ChoiceIllegalSaveException() { | ||
super(MESSAGE); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
backend/src/main/java/com/cruru/choice/service/ChoiceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.cruru.choice.service; | ||
|
||
import com.cruru.choice.controller.dto.ChoiceCreateRequest; | ||
import com.cruru.choice.domain.Choice; | ||
import com.cruru.choice.domain.repository.ChoiceRepository; | ||
import com.cruru.choice.exception.ChoiceEmptyBadRequestException; | ||
import com.cruru.choice.exception.ChoiceIllegalSaveException; | ||
import com.cruru.question.domain.Question; | ||
import com.cruru.question.domain.repository.QuestionRepository; | ||
import com.cruru.question.exception.QuestionNotFoundException; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
@RequiredArgsConstructor | ||
public class ChoiceService { | ||
|
||
private final ChoiceRepository choiceRepository; | ||
private final QuestionRepository questionRepository; | ||
|
||
@Transactional | ||
public List<Choice> createAll(List<ChoiceCreateRequest> requests, long questionId) { | ||
Question targetQuestion = questionRepository.findById(questionId) | ||
.orElseThrow(QuestionNotFoundException::new); | ||
|
||
if (!targetQuestion.hasChoice()) { | ||
throw new ChoiceIllegalSaveException(); | ||
} | ||
if (requests.isEmpty()) { | ||
throw new ChoiceEmptyBadRequestException(); | ||
} | ||
return choiceRepository.saveAll(toChoices(requests, targetQuestion)); | ||
} | ||
|
||
private List<Choice> toChoices(List<ChoiceCreateRequest> requests, Question question) { | ||
return requests.stream() | ||
.map(request -> new Choice(request.choice(), request.orderIndex(), question)) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 24 additions & 2 deletions
26
backend/src/main/java/com/cruru/dashboard/controller/dto/DashboardCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
package com.cruru.dashboard.controller.dto; | ||
|
||
import com.cruru.question.controller.dto.QuestionCreateRequest; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonFormat.Shape; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public record DashboardCreateRequest( | ||
@NotBlank(message = "대시보드 이름은 필수 값입니다.") | ||
String name | ||
@NotBlank(message = "공고 제목은 필수 값입니다.") | ||
String title, | ||
|
||
@JsonProperty("posting_content") | ||
String postingContent, | ||
|
||
List<QuestionCreateRequest> questions, | ||
|
||
@NotNull(message = "시작 날짜는 필수 값입니다.") | ||
@JsonFormat(shape = Shape.STRING) | ||
Dobby-Kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonProperty("start_date") | ||
LocalDateTime startDate, | ||
|
||
@NotNull(message = "종료 날짜는 필수 값입니다.") | ||
@JsonFormat(shape = Shape.STRING) | ||
@JsonProperty("due_date") | ||
LocalDateTime dueDate | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
다른 도메인에서(Process)는
@Setter
를 직접 사용하지 않고update필드명
으로 메서드명을 지어준 것 같습니다. 이에 대해 혹시 어떻게 생각하시나용?@Setter
또는update필드명
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.
해당 Process에서는 기존에 존재하는 정보를 '변경'하는 메서드로 update가 맞지만, 생성되기 전까지 Url이 존재하지 않는 이 케이스에 관해서는 setter의 의미가 더 적절한 것 같습니다.
오히려 update의 의미를 가진 메서드를 만들면 URL이 변동 가능성이 있는 field로 받아들여질 것 같습니다.
저는 필요와 의미에 따라 혼용하는 것을 선택할 것 같습니다