-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor/Inhabas#293] 공모전게시판 writerId 추가
- Loading branch information
1 parent
6458871
commit 6752365
Showing
4 changed files
with
47 additions
and
0 deletions.
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
40 changes: 40 additions & 0 deletions
40
...urce-server/src/main/java/com/inhabas/api/domain/menu/util/MenuTypeToMenuIdConverter.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,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<Integer> 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(); | ||
} | ||
} |
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