diff --git a/src/main/java/com/gdschongik/gdsc/domain/common/model/SemesterType.java b/src/main/java/com/gdschongik/gdsc/domain/common/model/SemesterType.java index dace965f4..72a0b990a 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/common/model/SemesterType.java +++ b/src/main/java/com/gdschongik/gdsc/domain/common/model/SemesterType.java @@ -7,9 +7,9 @@ @Getter @AllArgsConstructor public enum SemesterType { - FIRST("1학기", MonthDay.of(3, 1)), - SECOND("2학기", MonthDay.of(9, 1)); + FIRST(1, MonthDay.of(3, 1)), + SECOND(2, MonthDay.of(9, 1)); - private final String value; + private final Integer value; private final MonthDay startDate; } diff --git a/src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java b/src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java index 5c2b28e4a..8b2b5ecfa 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java @@ -9,7 +9,6 @@ import com.gdschongik.gdsc.domain.discord.dto.request.DiscordLinkRequest; import com.gdschongik.gdsc.domain.discord.dto.response.DiscordCheckDuplicateResponse; import com.gdschongik.gdsc.domain.discord.dto.response.DiscordCheckJoinResponse; -import com.gdschongik.gdsc.domain.discord.dto.response.DiscordNicknameResponse; import com.gdschongik.gdsc.domain.discord.dto.response.DiscordVerificationCodeResponse; import com.gdschongik.gdsc.domain.member.dao.MemberRepository; import com.gdschongik.gdsc.domain.member.domain.Member; @@ -83,19 +82,6 @@ private void updateDiscordId(String discordUsername, Member currentMember) { currentMember.updateDiscordId(discordId); } - @Transactional(readOnly = true) - public DiscordNicknameResponse checkDiscordRoleAssignable(String discordUsername) { - Member member = memberRepository - .findByDiscordUsername(discordUsername) - .orElseThrow(() -> new CustomException(MEMBER_NOT_FOUND)); - - if (!member.isRegular()) { - throw new CustomException(DISCORD_ROLE_UNASSIGNABLE); - } - - return DiscordNicknameResponse.of(member.getNickname()); - } - @Transactional(readOnly = true) public DiscordCheckDuplicateResponse checkUsernameDuplicate(String discordUsername) { boolean isExist = memberRepository.existsByDiscordUsername(discordUsername); diff --git a/src/main/java/com/gdschongik/gdsc/domain/discord/application/handler/JoinCommandHandler.java b/src/main/java/com/gdschongik/gdsc/domain/discord/application/handler/JoinCommandHandler.java deleted file mode 100644 index da646c5d4..000000000 --- a/src/main/java/com/gdschongik/gdsc/domain/discord/application/handler/JoinCommandHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gdschongik.gdsc.domain.discord.application.handler; - -import static com.gdschongik.gdsc.global.common.constant.DiscordConstant.*; - -import com.gdschongik.gdsc.domain.discord.application.OnboardingDiscordService; -import com.gdschongik.gdsc.domain.discord.dto.response.DiscordNicknameResponse; -import com.gdschongik.gdsc.global.util.DiscordUtil; -import java.util.Objects; -import lombok.RequiredArgsConstructor; -import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.events.GenericEvent; -import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; -import org.springframework.stereotype.Component; - -@Deprecated -@Component -@RequiredArgsConstructor -public class JoinCommandHandler implements DiscordEventHandler { - - private final OnboardingDiscordService onboardingDiscordService; - private final DiscordUtil discordUtil; - - @Override - public void delegate(GenericEvent genericEvent) { - SlashCommandInteractionEvent event = (SlashCommandInteractionEvent) genericEvent; - - event.deferReply().setEphemeral(true).setContent(DEFER_MESSAGE_JOIN).queue(); - - String discordUsername = event.getUser().getName(); - DiscordNicknameResponse response = onboardingDiscordService.checkDiscordRoleAssignable(discordUsername); - - Member member = event.getMember(); - Role role = discordUtil.findRoleByName(MEMBER_ROLE_NAME); - Guild guild = Objects.requireNonNull(event.getGuild()); - - guild.addRoleToMember(member, role).queue(); - guild.modifyNickname(member, response.nickname()).queue(); - - event.getHook().sendMessage(REPLY_MESSAGE_JOIN).setEphemeral(true).queue(); - } -} diff --git a/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/JoinCommandListener.java b/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/JoinCommandListener.java deleted file mode 100644 index a5d947443..000000000 --- a/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/JoinCommandListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.gdschongik.gdsc.domain.discord.application.listener; - -import static com.gdschongik.gdsc.global.common.constant.DiscordConstant.*; - -import com.gdschongik.gdsc.domain.discord.application.handler.JoinCommandHandler; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; -import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; -import net.dv8tion.jda.api.hooks.ListenerAdapter; - -@Deprecated -@Listener -@RequiredArgsConstructor -public class JoinCommandListener extends ListenerAdapter { - - private final JoinCommandHandler joinCommandHandler; - - @Override - public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { - if (event.getName().equals(COMMAND_NAME_JOIN)) { - joinCommandHandler.delegate(event); - } - } -} diff --git a/src/main/java/com/gdschongik/gdsc/domain/discord/dto/response/DiscordNicknameResponse.java b/src/main/java/com/gdschongik/gdsc/domain/discord/dto/response/DiscordNicknameResponse.java deleted file mode 100644 index 8983711cc..000000000 --- a/src/main/java/com/gdschongik/gdsc/domain/discord/dto/response/DiscordNicknameResponse.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.gdschongik.gdsc.domain.discord.dto.response; - -public record DiscordNicknameResponse(String nickname) { - - public static DiscordNicknameResponse of(String nickname) { - return new DiscordNicknameResponse(nickname); - } -} diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/api/OnboardingMemberController.java b/src/main/java/com/gdschongik/gdsc/domain/member/api/OnboardingMemberController.java index 07205df48..9bd572657 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/api/OnboardingMemberController.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/api/OnboardingMemberController.java @@ -2,10 +2,8 @@ import com.gdschongik.gdsc.domain.member.application.OnboardingMemberService; import com.gdschongik.gdsc.domain.member.dto.request.BasicMemberInfoRequest; -import com.gdschongik.gdsc.domain.member.dto.request.OnboardingMemberUpdateRequest; import com.gdschongik.gdsc.domain.member.dto.response.MemberBasicInfoResponse; import com.gdschongik.gdsc.domain.member.dto.response.MemberDashboardResponse; -import com.gdschongik.gdsc.domain.member.dto.response.MemberInfoResponse; import com.gdschongik.gdsc.domain.member.dto.response.MemberUnivStatusResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -14,7 +12,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -27,22 +24,6 @@ public class OnboardingMemberController { private final OnboardingMemberService onboardingMemberService; - @Deprecated - @Operation(summary = "디스코드 회원 정보 수정", description = "디스코드 회원 정보를 수정합니다.") - @PutMapping("/me/discord") - public ResponseEntity updateMember(@Valid @RequestBody OnboardingMemberUpdateRequest request) { - onboardingMemberService.updateMember(request); - return ResponseEntity.ok().build(); - } - - @Deprecated - @Operation(summary = "회원 정보 조회", description = "회원 정보를 조회합니다.") - @GetMapping("/me") - public ResponseEntity getMemberInfo() { - MemberInfoResponse response = onboardingMemberService.getMemberInfo(); - return ResponseEntity.ok().body(response); - } - @Operation(summary = "내 대시보드 조회", description = "내 대시보드를 조회합니다. 2차 MVP 기능입니다.") @GetMapping("/me/dashboard") public ResponseEntity getDashboard() { diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberService.java b/src/main/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberService.java index 3a2d59677..d9cc6b700 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberService.java @@ -9,10 +9,8 @@ import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.member.dto.request.BasicMemberInfoRequest; import com.gdschongik.gdsc.domain.member.dto.request.MemberTokenRequest; -import com.gdschongik.gdsc.domain.member.dto.request.OnboardingMemberUpdateRequest; import com.gdschongik.gdsc.domain.member.dto.response.MemberBasicInfoResponse; import com.gdschongik.gdsc.domain.member.dto.response.MemberDashboardResponse; -import com.gdschongik.gdsc.domain.member.dto.response.MemberInfoResponse; import com.gdschongik.gdsc.domain.member.dto.response.MemberTokenResponse; import com.gdschongik.gdsc.domain.member.dto.response.MemberUnivStatusResponse; import com.gdschongik.gdsc.domain.membership.application.MembershipService; @@ -39,26 +37,6 @@ public class OnboardingMemberService { private final MemberRepository memberRepository; private final EnvironmentUtil environmentUtil; - @Deprecated - @Transactional - public void updateMember(OnboardingMemberUpdateRequest request) { - Member currentMember = memberUtil.getCurrentMember(); - validateDiscordUsernameDuplicate(currentMember); - currentMember.verifyDiscord(request.discordUsername(), request.nickname()); - } - - private void validateDiscordUsernameDuplicate(Member member) { - if (memberRepository.existsByDiscordUsername(member.getDiscordUsername())) { - throw new CustomException(MEMBER_DISCORD_USERNAME_DUPLICATE); - } - } - - public MemberInfoResponse getMemberInfo() { - // TODO: 대시보드 API로 통합 - Member currentMember = memberUtil.getCurrentMember(); - return MemberInfoResponse.of(currentMember); - } - public MemberUnivStatusResponse checkUnivVerificationStatus() { Member currentMember = memberUtil.getCurrentMember(); return MemberUnivStatusResponse.from(currentMember); diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/AdminMemberResponse.java b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/AdminMemberResponse.java index 11243865b..434921dc1 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/AdminMemberResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/AdminMemberResponse.java @@ -3,6 +3,7 @@ import com.gdschongik.gdsc.domain.member.domain.AssociateRequirement; import com.gdschongik.gdsc.domain.member.domain.Department; import com.gdschongik.gdsc.domain.member.domain.Member; +import com.gdschongik.gdsc.global.util.formatter.PhoneFormatter; import java.util.Optional; public record AdminMemberResponse( @@ -21,10 +22,7 @@ public static AdminMemberResponse from(Member member) { member.getId(), member.getStudentId(), member.getName(), - Optional.ofNullable(member.getPhone()) - .map(phone -> String.format( - "%s-%s-%s", phone.substring(0, 3), phone.substring(3, 7), phone.substring(7))) - .orElse(null), + PhoneFormatter.format(member.getPhone()), DepartmentDto.from(member.getDepartment()), member.getEmail(), member.getDiscordUsername(), diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberBasicInfoResponse.java b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberBasicInfoResponse.java index df535bd19..986082d10 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberBasicInfoResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberBasicInfoResponse.java @@ -2,6 +2,7 @@ import com.gdschongik.gdsc.domain.member.domain.Department; import com.gdschongik.gdsc.domain.member.domain.Member; +import com.gdschongik.gdsc.global.util.formatter.PhoneFormatter; import java.util.Optional; public record MemberBasicInfoResponse( @@ -18,10 +19,7 @@ public static MemberBasicInfoResponse from(Member member) { member.getId(), member.getStudentId(), member.getName(), - Optional.ofNullable(member.getPhone()) - .map(phone -> String.format( - "%s-%s-%s", phone.substring(0, 3), phone.substring(3, 7), phone.substring(7))) - .orElse(null), + PhoneFormatter.format(member.getPhone()), Optional.ofNullable(member.getDepartment()) .map(Department::getDepartmentName) .orElse(null), diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberInfoResponse.java b/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberInfoResponse.java deleted file mode 100644 index 4c2badab4..000000000 --- a/src/main/java/com/gdschongik/gdsc/domain/member/dto/response/MemberInfoResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.gdschongik.gdsc.domain.member.dto.response; - -import com.gdschongik.gdsc.domain.common.model.RequirementStatus; -import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.member.domain.MemberRole; -import com.gdschongik.gdsc.global.util.formatter.PhoneFormatter; -import io.swagger.v3.oas.annotations.media.Schema; - -public record MemberInfoResponse( - Long memberId, - String studentId, - String name, - String phone, - String department, - String email, - String discordUsername, - String nickname, - @Schema(description = "디스코드 연동 상태") RequirementStatus discordStatus, - @Schema(description = "GDSC Bevy 가입 상태") RequirementStatus bevyStatus, - @Schema(description = "가입 상태") MemberRole role, - @Schema(description = "입금자명") String depositorName, - @Schema(description = "가입 상태") RegistrationStatus registrationStatus) { - - // TODO: 2차 MVP 응답 스펙에 맞게 수정 필요 - public static MemberInfoResponse of(Member member) { - return new MemberInfoResponse( - member.getId(), - member.getStudentId(), - member.getName(), - PhoneFormatter.format(member.getPhone()), - member.getDepartment().getDepartmentName(), - member.getEmail(), - member.getDiscordUsername(), - member.getNickname(), - member.getAssociateRequirement().getDiscordStatus(), - member.getAssociateRequirement().getBevyStatus(), - member.getRole(), - String.format("%s%s", member.getName(), member.getPhone().substring(7)), - RegistrationStatus.from(member)); - } - - enum RegistrationStatus { - APPLIED, - PENDING, - GRANTED; - - // TODO: 2차 MVP 응답 스펙에 맞게 수정 필요 - static RegistrationStatus from(Member member) { - return GRANTED; - } - } -} diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentResponse.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentResponse.java index 9b9f4aaef..30c385517 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentResponse.java @@ -19,9 +19,7 @@ public static AdminRecruitmentResponse from(Recruitment recruitment) { return new AdminRecruitmentResponse( recruitment.getId(), - SemesterFormatter.format( - recruitment.getAcademicYear(), - recruitment.getSemesterType().getValue()), + SemesterFormatter.format(recruitment), recruitment.getSemesterPeriod().getStartDate(), recruitment.getSemesterPeriod().getEndDate(), String.format("%s원", decimalFormat.format(recruitment.getFee().getAmount())), diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentRoundResponse.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentRoundResponse.java index 57c2f36b9..b1b402497 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentRoundResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/response/AdminRecruitmentRoundResponse.java @@ -17,9 +17,7 @@ public static AdminRecruitmentRoundResponse from(RecruitmentRound recruitmentRou return new AdminRecruitmentRoundResponse( recruitmentRound.getId(), - SemesterFormatter.format( - recruitmentRound.getAcademicYear(), - recruitmentRound.getSemesterType().getValue()), + SemesterFormatter.format(recruitmentRound), recruitmentRound.getPeriod().getStartDate(), recruitmentRound.getPeriod().getEndDate(), recruitmentRound.getName(), diff --git a/src/main/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java b/src/main/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java index 597bbcd31..81aa63986 100644 --- a/src/main/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java +++ b/src/main/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java @@ -15,12 +15,6 @@ private DiscordConstant() {} public static final String DEFER_MESSAGE_ISSUING_CODE = "인증코드를 발급받는 중입니다..."; public static final String REPLY_MESSAGE_ISSUING_CODE = "인증코드는 %d 입니다. 인증코드는 %d분 동안 유효합니다."; - // 가입하기 커맨드 - public static final String COMMAND_NAME_JOIN = "가입하기"; - public static final String COMMAND_DESCRIPTION_JOIN = "가입 신청이 승인된 멤버에게 역할을 부여합니다."; - public static final String DEFER_MESSAGE_JOIN = "가입 신청을 처리하는 중입니다..."; - public static final String REPLY_MESSAGE_JOIN = "가입 신청이 승인되었습니다. GDSC Hongik에 합류하신 것을 환영합니다!"; - // 디스코드 ID 저장 커맨드 public static final String COMMAND_NAME_BATCH_DISCORD_ID = "디스코드id-저장하기"; public static final String COMMAND_DESCRIPTION_BATCH_DISCORD_ID = "디스코드 인증이 완료된 멤버들의 디스코드 ID를 저장합니다."; diff --git a/src/main/java/com/gdschongik/gdsc/global/config/DiscordConfig.java b/src/main/java/com/gdschongik/gdsc/global/config/DiscordConfig.java index 2e605e99f..4b429d9dd 100644 --- a/src/main/java/com/gdschongik/gdsc/global/config/DiscordConfig.java +++ b/src/main/java/com/gdschongik/gdsc/global/config/DiscordConfig.java @@ -42,7 +42,6 @@ public JDA jda() { Objects.requireNonNull(jda.awaitReady().getGuildById(discordProperty.getServerId())) .updateCommands() .addCommands(Commands.slash(COMMAND_NAME_ISSUING_CODE, COMMAND_DESCRIPTION_ISSUING_CODE)) - .addCommands(Commands.slash(COMMAND_NAME_JOIN, COMMAND_DESCRIPTION_JOIN)) .addCommands(Commands.slash(COMMAND_NAME_BATCH_DISCORD_ID, COMMAND_DESCRIPTION_BATCH_DISCORD_ID)) .queue(); diff --git a/src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java b/src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java index 57d2bf744..5b1af0388 100644 --- a/src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java +++ b/src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java @@ -63,7 +63,6 @@ public enum ErrorCode { DISCORD_INVALID_CODE_RANGE(HttpStatus.INTERNAL_SERVER_ERROR, "디스코드 인증코드는 4자리 숫자여야 합니다."), DISCORD_CODE_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 유저네임으로 발급된 디스코드 인증코드가 존재하지 않습니다."), DISCORD_CODE_MISMATCH(HttpStatus.CONFLICT, "디스코드 인증코드가 일치하지 않습니다."), - DISCORD_ROLE_UNASSIGNABLE(HttpStatus.INTERNAL_SERVER_ERROR, "디스코드 역할 부여가 불가능합니다. 가입 조건을 확인해주세요."), DISCORD_ROLE_NOT_FOUND(HttpStatus.NOT_FOUND, "디스코드 역할을 찾을 수 없습니다."), DISCORD_NOT_SIGNUP(HttpStatus.INTERNAL_SERVER_ERROR, "아직 가입신청서를 작성하지 않은 회원입니다."), DISCORD_NICKNAME_NOTNULL(HttpStatus.INTERNAL_SERVER_ERROR, "닉네임은 빈 값이 될 수 없습니다."), diff --git a/src/main/java/com/gdschongik/gdsc/global/util/formatter/MoneyFormatter.java b/src/main/java/com/gdschongik/gdsc/global/util/formatter/MoneyFormatter.java new file mode 100644 index 000000000..a7f7c4f37 --- /dev/null +++ b/src/main/java/com/gdschongik/gdsc/global/util/formatter/MoneyFormatter.java @@ -0,0 +1,18 @@ +package com.gdschongik.gdsc.global.util.formatter; + +import com.gdschongik.gdsc.domain.common.vo.Money; +import java.text.NumberFormat; +import java.util.Locale; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.NonNull; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class MoneyFormatter { + + public static final NumberFormat KOREA_NUMBER_FORMAT = NumberFormat.getNumberInstance(Locale.KOREA); + + public static String format(@NonNull Money money) { + return KOREA_NUMBER_FORMAT.format(money.getAmount()) + "원"; + } +} diff --git a/src/main/java/com/gdschongik/gdsc/global/util/formatter/PhoneFormatter.java b/src/main/java/com/gdschongik/gdsc/global/util/formatter/PhoneFormatter.java index 70d13a45a..1fd675919 100644 --- a/src/main/java/com/gdschongik/gdsc/global/util/formatter/PhoneFormatter.java +++ b/src/main/java/com/gdschongik/gdsc/global/util/formatter/PhoneFormatter.java @@ -6,15 +6,8 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class PhoneFormatter { - public static String format(@Nullable String phone) { - return phone == null - ? null - : new StringBuilder(12) - .append(phone, 0, 3) - .append('-') - .append(phone, 3, 7) - .append('-') - .append(phone, 7, 11) - .toString(); + @Nullable public static String format(@Nullable String phone) { + if (phone == null) return null; + return phone.substring(0, 3) + '-' + phone.substring(3, 7) + '-' + phone.substring(7, 11); } } diff --git a/src/main/java/com/gdschongik/gdsc/global/util/formatter/SemesterFormatter.java b/src/main/java/com/gdschongik/gdsc/global/util/formatter/SemesterFormatter.java index 679c47972..7612d5823 100644 --- a/src/main/java/com/gdschongik/gdsc/global/util/formatter/SemesterFormatter.java +++ b/src/main/java/com/gdschongik/gdsc/global/util/formatter/SemesterFormatter.java @@ -1,11 +1,17 @@ package com.gdschongik.gdsc.global.util.formatter; +import com.gdschongik.gdsc.domain.common.model.BaseSemesterEntity; import lombok.AccessLevel; import lombok.NoArgsConstructor; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class SemesterFormatter { - public static String format(Integer academicYear, String semester) { - return String.format("%d-%s", academicYear, semester); + public static String format(BaseSemesterEntity semesterEntity) { + return semesterEntity.getAcademicYear() + "-" + + semesterEntity.getSemesterType().getValue(); + } + + public static String formatType(BaseSemesterEntity semesterEntity) { + return semesterEntity.getSemesterType().getValue() + "학기"; } }