diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java index 9d5313a6..904aefbe 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDto.java @@ -28,6 +28,8 @@ public class ContestBoardDetailDto { @NotBlank private String content; + @NotNull private Long writerId; + @NotBlank private String writerName; @NotBlank private String association; @@ -66,6 +68,7 @@ public ContestBoardDetailDto( Long contestFieldId, String title, String content, + Long writerId, String writerName, String association, String topic, @@ -80,6 +83,7 @@ public ContestBoardDetailDto( this.contestFieldId = contestFieldId; this.title = title; this.content = content; + this.writerId = writerId; this.writerName = writerName; this.association = association; this.topic = topic; diff --git a/resource-server/src/main/java/com/inhabas/api/domain/menu/util/MenuTypeToMenuIdConverter.java b/resource-server/src/main/java/com/inhabas/api/domain/menu/util/MenuTypeToMenuIdConverter.java new file mode 100644 index 00000000..c24d5d98 --- /dev/null +++ b/resource-server/src/main/java/com/inhabas/api/domain/menu/util/MenuTypeToMenuIdConverter.java @@ -0,0 +1,40 @@ +package com.inhabas.api.domain.menu.util; + +import java.util.Optional; + +import com.inhabas.api.domain.contest.domain.ContestType; +import com.inhabas.api.domain.menu.domain.valueObject.MenuType; +import com.inhabas.api.domain.normalBoard.domain.NormalBoardType; +import com.inhabas.api.domain.project.domain.ProjectBoardType; + +public class MenuTypeToMenuIdConverter { + + // menuType을 boardType을 통해 menuId로 변환 + public static Optional MenuTypeToMenuId(MenuType menuType) { + Integer menuId = null; + + // NormalBoardType enum을 확인 + for (NormalBoardType boardType : NormalBoardType.values()) { + if (boardType.getBoardType().equalsIgnoreCase(menuType.toString())) { + return Optional.of(boardType.getMenuId()); + } + } + + // ProjectBoardType을 확인 + for (ProjectBoardType projectBoardType : ProjectBoardType.values()) { + if (projectBoardType.getBoardType().equalsIgnoreCase(menuType.toString())) { + return Optional.of(projectBoardType.getMenuId()); + } + } + + // ContestBoardType을 확인 + for (ContestType contestType : ContestType.values()) { + if (contestType.getBoardType().equalsIgnoreCase(menuType.toString())) { + return Optional.of(contestType.getMenuId()); + } + } + + // 못찾으면 Optional.empty() 반환 + return Optional.empty(); + } +} diff --git a/resource-server/src/main/java/com/inhabas/api/domain/normalBoard/dto/NormalBoardDetailDto.java b/resource-server/src/main/java/com/inhabas/api/domain/normalBoard/dto/NormalBoardDetailDto.java index 618a221b..8321cbac 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/normalBoard/dto/NormalBoardDetailDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/normalBoard/dto/NormalBoardDetailDto.java @@ -24,6 +24,7 @@ public class NormalBoardDetailDto { @NotBlank private String title; @NotBlank private String content; + @NotNull private Long writerId; @NotBlank private String writerName; diff --git a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java index b9d04c1e..41507db8 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/contest/dto/ContestBoardDetailDtoTest.java @@ -44,6 +44,7 @@ public void createContestBoardDetailDto() { .contestFieldId(1L) .title("테스트 제목") .content("테스트 내용") + .writerId(1L) .writerName("송민석") .association("(주) 아이바스") .topic("테스트 주제") @@ -75,6 +76,7 @@ public void nullTitleTest() { .contestFieldId(1L) // title 필드 null .content("테스트 내용") + .writerId(1L) .writerName("송민석") .association("(주) 아이바스") .topic("테스트 주제")