package kr.itn.itnhub.seed; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; @RestController public class SeedController { private final SeedService seedService; public SeedController(SeedService seedService) { this.seedService = seedService; } @PostMapping("/api/seed") public SeedReport upload(@RequestParam("file") MultipartFile file) throws IOException { if (file.isEmpty()) { throw new SeedParseException("업로드된 파일이 비어 있습니다."); } try (InputStream in = file.getInputStream()) { return seedService.seed(in); } } }