package com.ddf.vodsystem.controllers; import com.ddf.vodsystem.dto.APIResponse; import com.ddf.vodsystem.services.UploadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("api/v1/upload") public class UploadController { private final UploadService uploadService; @Autowired public UploadController(UploadService uploadService) { this.uploadService = uploadService; } @PostMapping() public ResponseEntity> uploadVideo(@RequestParam("file") MultipartFile file) { if (file == null || file.isEmpty()) { throw new IllegalArgumentException("Invalid file"); } String uuid = uploadService.upload(file); APIResponse response = new APIResponse<>("success", "File uploaded successfully", java.util.Collections.singletonMap("uuid", uuid)); return new ResponseEntity<>(response, HttpStatus.OK); } }