ADD metadata endpoints + update Bruno

This commit is contained in:
2025-05-20 14:12:12 +02:00
parent a639cfbb0e
commit 9348dd928e
8 changed files with 55 additions and 62 deletions

View File

@@ -0,0 +1,44 @@
package com.ddf.vodsystem.controllers;
import com.ddf.vodsystem.entities.VideoMetadata;
import com.ddf.vodsystem.services.JobService;
import org.springframework.http.HttpStatus;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1/metadata")
public class MetadataController {
private final JobService jobService;
public MetadataController(JobService jobService) {
this.jobService = jobService;
}
@GetMapping("/original/{uuid}")
public ResponseEntity<VideoMetadata> getMetadata(@PathVariable String uuid) {
VideoMetadata originalMetadata = jobService.getJob(uuid).getInputVideoMetadata();
if (originalMetadata == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok()
.body(originalMetadata);
}
@GetMapping("/converted/{uuid}")
public ResponseEntity<VideoMetadata> getConvertedMetadata(@PathVariable String uuid) {
VideoMetadata convertedMetadata = jobService.getJob(uuid).getOutputVideoMetadata();
if (convertedMetadata == null) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok()
.body(convertedMetadata);
}
}

View File

@@ -18,7 +18,7 @@ public class UploadController {
this.uploadService = uploadService;
}
@PostMapping("/")
@PostMapping()
public ResponseEntity<String> uploadVideo(@RequestParam("file") MultipartFile file) {
String uuid = uploadService.upload(file);