From 547b79187512fb7d731ee3ea4ba487b9f967d9a2 Mon Sep 17 00:00:00 2001 From: hjh Date: Sun, 20 Jul 2025 21:21:43 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=B4=EA=B0=80=20=EC=93=B4=20=EA=B8=80=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/CommunityConverter.java | 14 ++++++++++++++ .../helloworldmvc/converter/MyPageConverter.java | 2 +- .../helloworldmvc/web/dto/MyPageResponseDTO.java | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) 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; }