Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: original file name을 반환하도록 수정 #77

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}