Skip to content

Commit

Permalink
refactor(file): 컨트롤러 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
NameIsUser06 committed Apr 29, 2024
1 parent 8292be5 commit 390f22b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
package com.project.bumawiki.domain.file.presentation;

import com.project.bumawiki.domain.file.presentation.dto.FileResponseDto;
import com.project.bumawiki.domain.file.presentation.dto.R2FileResponseDto;
import com.project.bumawiki.domain.file.service.CommandFileService;

import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;

import org.springframework.web.multipart.MultipartFile;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/image")
@RequestMapping("/api/file")
public class FileController {
private final CommandFileService commandFileService;

@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public R2FileResponseDto upload(@RequestPart("file") MultipartFile file) {
return R2FileResponseDto.from(
commandFileService.uploadFile(file)
);
}

@GetMapping("/display/{docsName}/{fileName}")
public ResponseEntity<Resource> displayImage(
@PathVariable String fileName,
Expand Down

This file was deleted.

0 comments on commit 390f22b

Please sign in to comment.