Skip to content

Commit 357a2ba

Browse files
rlajm1203claude
andauthored
[fix]: 지원서 생성 시 보드 연결 순서 오류 수정 (#417)
save() 후 목록 조회로 인해 새 보드가 자기 자신을 참조하는 버그 수정. 기존 보드 목록을 save() 이전에 조회하도록 순서를 변경하고 빈 목록 체크 추가. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cdc4ee7 commit 357a2ba

File tree

1 file changed

+12
-10
lines changed
  • server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service

1 file changed

+12
-10
lines changed

server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service/BoardService.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ public Columns createColumn(String title, Integer navigationId) {
164164

165165
@Override
166166
public void createApplicantBoard(String applicantId, String hopeField, Long cardId) {
167-
// \"hopeField\" -> hopeField 로 변경
168-
hopeField = hopeField;
169167
Integer year = latestRecruitmentVo.getYear();
170168
if (hopeField.equals("개발자") || hopeField.equals("디자이너") || hopeField.equals("기획자")) {
171169
log.info("ApplicantBoard 생성 : {}, applicantId : {}", hopeField, applicantId);
@@ -176,6 +174,9 @@ public void createApplicantBoard(String applicantId, String hopeField, Long card
176174

177175
Columns column = columnLoadPort.getColumnByYearAndTitle(hopeField, year);
178176

177+
// 기존에 null 인 nextBoardId를 현재 boardId로 업데이트
178+
List<Board> existingBoards =
179+
boardLoadPort.getBoardByNavigationIdAndColumnsId(1, column.getId());
179180
Board board =
180181
Board.builder()
181182
.cardType(CardType.APPLICANT)
@@ -185,14 +186,15 @@ public void createApplicantBoard(String applicantId, String hopeField, Long card
185186
.cardId(cardId)
186187
.build();
187188
Board save = boardRecordPort.save(board);
188-
// 기존에 null 인 nextBoardId를 현재 boardId로 업데이트
189-
boardLoadPort.getBoardByNavigationIdAndColumnsId(1, column.getId()).stream()
190-
.filter(b -> b.getNextBoardId() == null)
191-
.findFirst()
192-
.ifPresent(
193-
b -> {
194-
b.updateNextBoardID(save.getId());
195-
});
189+
if (!existingBoards.isEmpty()) {
190+
existingBoards.stream()
191+
.filter(b -> b.getNextBoardId() == null)
192+
.findFirst()
193+
.ifPresent(
194+
b -> {
195+
b.updateNextBoardID(save.getId());
196+
});
197+
}
196198
}
197199

198200
@Override

0 commit comments

Comments
 (0)