From 1948e992d544f83910a167904aa6adcb72962b69 Mon Sep 17 00:00:00 2001 From: kms Date: Wed, 22 Nov 2023 01:20:59 +0900 Subject: [PATCH] :wrench: fix: add extractAccessToken before extractUserId #70 --- .../watchboard/controller/AudioFileController.java | 3 ++- .../controller/LearningFileController.java | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/smart/watchboard/controller/AudioFileController.java b/src/main/java/com/smart/watchboard/controller/AudioFileController.java index 24efb22..d5fadb9 100644 --- a/src/main/java/com/smart/watchboard/controller/AudioFileController.java +++ b/src/main/java/com/smart/watchboard/controller/AudioFileController.java @@ -47,7 +47,8 @@ public class AudioFileController { @PostMapping("/{documentID}/audio") public ResponseEntity uploadAudioFile(@PathVariable(value = "documentID") long documentId, @RequestParam("audio") MultipartFile audioFile, @RequestHeader("Authorization") String accessToken) throws UnsupportedAudioFileException, IOException, DocumentException { - Optional id = jwtService.extractUserId(accessToken); + String extractedAccessToken = jwtService.extractAccessToken(accessToken); + Optional id = jwtService.extractUserId(extractedAccessToken); Long userId = id.orElse(null); // s3에 오디오 파일 저장 diff --git a/src/main/java/com/smart/watchboard/controller/LearningFileController.java b/src/main/java/com/smart/watchboard/controller/LearningFileController.java index 65b5de8..2052393 100644 --- a/src/main/java/com/smart/watchboard/controller/LearningFileController.java +++ b/src/main/java/com/smart/watchboard/controller/LearningFileController.java @@ -38,7 +38,8 @@ public class LearningFileController { @PostMapping("/{documentID}/pdf") public ResponseEntity uploadLearningFile(@PathVariable(value = "documentID") long documentId, @RequestParam("pdf") MultipartFile pdfFile, @RequestHeader("Authorization") String accessToken) throws UnsupportedAudioFileException, IOException { - Optional id = jwtService.extractUserId(accessToken); + String extractedAccessToken = jwtService.extractAccessToken(accessToken); + Optional id = jwtService.extractUserId(extractedAccessToken); Long userId = id.orElse(null); if (!checkPageLimit(countPdfPage(pdfFile))) { @@ -47,16 +48,9 @@ public ResponseEntity uploadLearningFile(@PathVariable(value = "documentID") S3Dto s3Dto = new S3Dto(pdfFile, documentId, userId, "pdf"); String path = awsS3Uploader.uploadFile(s3Dto); - //sseService.notifyKeywords(documentId, path); - //sseService.notifySummary(documentId, path); -// ResponseEntity responseEntity = requestService.requestPdfKeywords(path); -// keywordService.createKeywords(responseEntity, documentId); -// -// ResponseEntity summary = requestService.requestPdfSummary(path); -// summaryService.createSummary(documentId, summary.getBody().getSummary()); + whiteboardService.setDataType(documentId, "pdf"); - //return new ResponseEntity<>(responseEntity.getBody(), HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK); }