From 9b5faffa9ca6f8e23f498ff2d57ce4ca62d25f81 Mon Sep 17 00:00:00 2001 From: miiiinju1 Date: Wed, 18 Oct 2023 16:35:18 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20[REFACTOR]=20=EC=A0=9C=EC=B6=9C=20A?= =?UTF-8?q?PI=20=EC=88=98=EC=A0=95=20#471?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #471 --- .../domain/codeSubmit/constants/SubmitConstants.java | 10 +++++----- .../morandi/domain/codeSubmit/dto/SubmitCodeDto.java | 2 +- .../codeSubmit/service/BaekjoonSubmitService.java | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/swm_nm/morandi/domain/codeSubmit/constants/SubmitConstants.java b/src/main/java/swm_nm/morandi/domain/codeSubmit/constants/SubmitConstants.java index b2e39f83..44a5d81a 100644 --- a/src/main/java/swm_nm/morandi/domain/codeSubmit/constants/SubmitConstants.java +++ b/src/main/java/swm_nm/morandi/domain/codeSubmit/constants/SubmitConstants.java @@ -6,12 +6,12 @@ @RequiredArgsConstructor @Getter public enum SubmitConstants { - JAVA("93"), - C_PLUSPLUS("84"), - PYTHON("28"), - PYPY3("73"), + Java("93"), + Cpp("84"), + Python("28"), + Pypy3("73"), C99("0"), - RUBY("68"), + Ruby("68"), KOTLIN("69"), SWIFT("74"), TEXT("58"), diff --git a/src/main/java/swm_nm/morandi/domain/codeSubmit/dto/SubmitCodeDto.java b/src/main/java/swm_nm/morandi/domain/codeSubmit/dto/SubmitCodeDto.java index 22fc8c49..f145d5a9 100644 --- a/src/main/java/swm_nm/morandi/domain/codeSubmit/dto/SubmitCodeDto.java +++ b/src/main/java/swm_nm/morandi/domain/codeSubmit/dto/SubmitCodeDto.java @@ -10,7 +10,7 @@ @Getter @Setter public class SubmitCodeDto { - public String problemId; + public String bojProblemId; public String language; public String sourceCode; diff --git a/src/main/java/swm_nm/morandi/domain/codeSubmit/service/BaekjoonSubmitService.java b/src/main/java/swm_nm/morandi/domain/codeSubmit/service/BaekjoonSubmitService.java index dbcf68f7..3e06d199 100644 --- a/src/main/java/swm_nm/morandi/domain/codeSubmit/service/BaekjoonSubmitService.java +++ b/src/main/java/swm_nm/morandi/domain/codeSubmit/service/BaekjoonSubmitService.java @@ -102,9 +102,9 @@ public String getCSRFKey(String cookie, String problemId) { } //POST로 보낼 때 필요한 파라미터들을 생성 - private MultiValueMap createParameters(SubmitCodeDto submitCodeDto, String CSRFKey, String problemId) { + private MultiValueMap createParameters(SubmitCodeDto submitCodeDto, String CSRFKey, String bojProblemId) { MultiValueMap parameters = new LinkedMultiValueMap<>(); - parameters.add("problem_id", problemId); + parameters.add("problem_id", bojProblemId); parameters.add("language", submitCodeDto.getLanguageId()); parameters.add("code_open", CodeVisuabilityConstants.CLOSE.getCodeVisuability()); parameters.add("source", submitCodeDto.getSourceCode()); @@ -118,16 +118,16 @@ public ResponseEntity submit(SubmitCodeDto submitCodeDto) { String cookie = Optional.ofNullable((String) redisTemplate.opsForValue().get(key)) .orElseThrow(() -> new MorandiException(SubmitErrorCode.COOKIE_NOT_EXIST)); - String problemId = submitCodeDto.getProblemId(); + String bojProblemId = submitCodeDto.getBojProblemId(); - String CSRFKey = getCSRFKey(cookie, problemId); + String CSRFKey = getCSRFKey(cookie, bojProblemId); - String acmicpcUrl = "https://www.acmicpc.net/submit/" + problemId; + String acmicpcUrl = "https://www.acmicpc.net/submit/" + bojProblemId; HttpHeaders headers = createHeaders(cookie); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap parameters = createParameters(submitCodeDto, CSRFKey, problemId); + MultiValueMap parameters = createParameters(submitCodeDto, CSRFKey, bojProblemId); HttpEntity> request = new HttpEntity<>(parameters, headers);