diff --git a/src/main/java/com/example/helloworldmvc/converter/CommunityConverter.java b/src/main/java/com/example/helloworldmvc/converter/CommunityConverter.java index f836f72..e3e70d1 100644 --- a/src/main/java/com/example/helloworldmvc/converter/CommunityConverter.java +++ b/src/main/java/com/example/helloworldmvc/converter/CommunityConverter.java @@ -96,4 +96,18 @@ public static CommunityCategory toCommunityCategory(Long categoryId){ } return communityCategory; } + + public static Long toCategoryId(CommunityCategory category) { + switch (category) { + case WORRY: + return 0L; + case MEDICAL: + return 1L; + case QUALIFICATION: + return 2L; + default: + return 3L; + } + } + } diff --git a/src/main/java/com/example/helloworldmvc/converter/MyPageConverter.java b/src/main/java/com/example/helloworldmvc/converter/MyPageConverter.java index b44942e..09a06f6 100644 --- a/src/main/java/com/example/helloworldmvc/converter/MyPageConverter.java +++ b/src/main/java/com/example/helloworldmvc/converter/MyPageConverter.java @@ -120,7 +120,7 @@ public static MyPageResponseDTO.MyCommunityResDTO toMyCommunityRes(Community com .title(community.getTitle()) .content(community.getContent()) .uploadedAt(community.getCreatedAt()) - .category(community.getCommunityCategory().name()) + .category(CommunityConverter.toCategoryId(community.getCommunityCategory())) .commentCnt((long) community.getCommentList().size()) .imageUrl(imageUrl) .build(); diff --git a/src/main/java/com/example/helloworldmvc/web/dto/MyPageResponseDTO.java b/src/main/java/com/example/helloworldmvc/web/dto/MyPageResponseDTO.java index 76ca533..8270a24 100644 --- a/src/main/java/com/example/helloworldmvc/web/dto/MyPageResponseDTO.java +++ b/src/main/java/com/example/helloworldmvc/web/dto/MyPageResponseDTO.java @@ -103,7 +103,7 @@ public static class MyCommunityResDTO { String title; String content; LocalDateTime uploadedAt; - String category; + Long category; Long commentCnt; String imageUrl; }