Skip to content

Commit

Permalink
feat: original file name을 반환하도록 수정 (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitchannn authored Mar 4, 2024
1 parent ce8f3a7 commit 7134abc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import sunflower.server.api.response.BrfFileQueryResponse;
import sunflower.server.api.response.PdfRegisterResponse;
import sunflower.server.api.response.TranslationStatusResponse;
import sunflower.server.application.TranslationService;
import sunflower.server.application.dto.TranslationStatusDto;
Expand Down Expand Up @@ -43,7 +44,7 @@ public class TranslationApiController {
required = true
))
@PostMapping(consumes = MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Void> registerPdf(
public ResponseEntity<PdfRegisterResponse> registerPdf(
@Parameter(name = "file", description = "점역할 pdf 파일", required = true,
example = "쎈_3124번.pdf", schema = @Schema(type = "file"))
@RequestPart("file") MultipartFile file
Expand All @@ -56,7 +57,7 @@ public ResponseEntity<Void> registerPdf(

return ResponseEntity
.created(URI.create("/translations/" + id))
.build();
.body(PdfRegisterResponse.from(file.getOriginalFilename()));
}

@Operation(summary = "점역 상황 체크 API", description = "id와 함께 요청하면 점역 진행 상황을 반환하며, 클라이언트의 progress bar 표시를 위해 사용해 주세요.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package sunflower.server.api.response;

import lombok.Getter;

@Getter
public class PdfRegisterResponse {

private String originalFileName;

public PdfRegisterResponse() {
}

public PdfRegisterResponse(final String originalFileName) {
this.originalFileName = originalFileName;
}

public static PdfRegisterResponse from(final String originalFilename) {
return new PdfRegisterResponse(originalFilename);
}
}

0 comments on commit 7134abc

Please sign in to comment.