Skip to content

Commit

Permalink
#21 delete: S3StorageController 내 soutv 출력 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
jinno321 committed Oct 10, 2024
1 parent b06e2ff commit e23e995
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ResponseEntity<String> uploadPdf(
@Parameter(description = "pdf 정보",required = true)
@RequestParam String pdfInfo,
@Parameter(description = "pdf 키값",required = true)
@RequestParam String pdfKey) {
@RequestParam String pdfKey) throws IOException {
Wallet wallet = walletService.getWalletById(walletId).orElseThrow(()-> new EntityNotFoundException("Wallet does not exist"));
String pdfUrl = s3StorageService.uploadPdf(file, wallet,pdfInfo,pdfKey);
return ResponseEntity.ok(pdfUrl);
Expand All @@ -57,7 +57,6 @@ public ResponseEntity<Void> deleteWallet(
@Parameter(description = "지울 pdf 파일 경로 관련 Dto",required = true)
@RequestBody DeletePdfRequest request) {
String urlToDelete = request.getUrlToDelete();
System.out.println("urlToDelete = " + urlToDelete);
s3StorageService.deletePdf(urlToDelete);
return ResponseEntity.noContent().build();
}
Expand All @@ -68,7 +67,6 @@ public ResponseEntity<Void> deleteCertForPage(
@Parameter(description = "walletId와 삭제할 page가 담긴 Dto",required = true)
@RequestBody DeleteCertRequest request
) throws IOException, S3UploadException {
System.out.println("request = " + request);
Long walletId = request.getWalletId();
int page = request.getPage();
Wallet wallet = walletService.getWalletById(walletId).orElseThrow(()-> new EntityNotFoundException("Wallet does not exist"));
Expand Down Expand Up @@ -110,9 +108,8 @@ public ResponseEntity<String> replacePdf(
@Parameter(description = "페이지 번호",required = true)
@RequestParam("page") int page,
@Parameter(description = "사용자 지갑ID",required = true)
@RequestParam("walletId") Long walletId) {
@RequestParam("walletId") Long walletId) throws IOException {

System.out.println("file = " + file);
Wallet wallet = walletService.getWalletById(walletId).orElseThrow(()-> new EntityNotFoundException("Wallet does not exist"));
String pdfUrl = s3StorageService.replacePdfPage(wallet, page, file);
return ResponseEntity.ok(pdfUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ private byte[] createEmptyPdf(){

@Transactional
public String replacePdfPage(Wallet wallet, int pageNumberToRemove, MultipartFile newPdfFile) throws IOException{

// 원래 PDF 가져오기
String pdfUrl = wallet.getPdfUrl();
byte[] originalPdfBytes = getOriginalPdfBytes(pdfUrl);
Expand Down Expand Up @@ -360,8 +359,6 @@ public String getPdfKeyForPage(String pdfUrl, int pageNumber) {
return null; // 결과가 없거나 ':'가 없는 경우 null 반환
}



public int getPdfPageCount(byte[] pdfBytes){
try (PDDocument document = PDDocument.load(pdfBytes)) {
return document.getNumberOfPages();
Expand Down

0 comments on commit e23e995

Please sign in to comment.