From 49ded8c3f885332f20b075f8a6056e1d96f2ce76 Mon Sep 17 00:00:00 2001 From: "chosw1002@naver.com" Date: Thu, 22 Feb 2024 00:22:42 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20dto=EC=9D=98=20phone=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EB=B0=9C=EC=83=9D=20=EA=B0=80=EB=8A=A5=ED=95=9C=20NPE=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/dto/response/MemberFindAllResponse.java | 14 +++++++++----- .../dto/response/MemberPendingFindAllResponse.java | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberFindAllResponse.java b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberFindAllResponse.java index b5191b745..07722c9a1 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberFindAllResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberFindAllResponse.java @@ -13,15 +13,19 @@ public record MemberFindAllResponse( String nickname) { public static MemberFindAllResponse of(Member member) { + String phone = null; + if (member.getPhone() != null) { + phone = String.format( + "%s-%s-%s", + member.getPhone().substring(0, 3), + member.getPhone().substring(3, 7), + member.getPhone().substring(7)); + } return new MemberFindAllResponse( member.getId(), member.getStudentId(), member.getName(), - String.format( - "%s-%s-%s", - member.getPhone().substring(0, 3), - member.getPhone().substring(3, 7), - member.getPhone().substring(7)), + phone, member.getDepartment(), member.getEmail(), member.getDiscordUsername(), diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberPendingFindAllResponse.java b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberPendingFindAllResponse.java index 0d854a5bd..fd693fbd1 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberPendingFindAllResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberPendingFindAllResponse.java @@ -15,15 +15,19 @@ public record MemberPendingFindAllResponse( Requirement requirement) { public static MemberPendingFindAllResponse of(Member member) { + String phone = null; + if (member.getPhone() != null) { + phone = String.format( + "%s-%s-%s", + member.getPhone().substring(0, 3), + member.getPhone().substring(3, 7), + member.getPhone().substring(7)); + } return new MemberPendingFindAllResponse( member.getId(), member.getStudentId(), member.getName(), - String.format( - "%s-%s-%s", - member.getPhone().substring(0, 3), - member.getPhone().substring(3, 7), - member.getPhone().substring(7)), + phone, member.getDepartment(), member.getEmail(), member.getDiscordUsername(),