REFACTOR to be more modular

This commit is contained in:
2025-05-09 18:56:24 +02:00
parent de382feeff
commit 4d59456292
7 changed files with 36 additions and 68 deletions

View File

@@ -1,7 +1,7 @@
package com.ddf.vodsystem.services;
import com.ddf.vodsystem.entities.EditDTO;
import com.ddf.vodsystem.entities.Job;
import com.ddf.vodsystem.entities.ClipConfig;
import com.ddf.vodsystem.tools.Job;
import org.springframework.stereotype.Service;
@Service
@@ -12,40 +12,18 @@ public class EditService {
this.jobService = jobService;
}
public void edit(String uuid, EditDTO editDTO) {
public void edit(String uuid, ClipConfig clipConfig) {
Job job = jobService.get(uuid);
if (editDTO.getStartPoint() != null) {
if (editDTO.getStartPoint() < 0) {
if (clipConfig.getStartPoint() != null) {
if (clipConfig.getStartPoint() < 0) {
throw new IllegalArgumentException("Start point cannot be negative");
}
job.setStartPoint(editDTO.getStartPoint());
}
if (editDTO.getEndPoint() != null) {
job.setEndPoint(editDTO.getEndPoint());
}
job.setClipConfig(clipConfig);
if (editDTO.getFps() != null) {
job.setFps(editDTO.getFps());
}
if (editDTO.getWidth() != null) {
job.setWidth(editDTO.getWidth());
}
if (editDTO.getHeight() != null) {
job.setHeight(editDTO.getHeight());
}
if (editDTO.getFileSize() != null) {
if (editDTO.getFileSize() < 0) {
throw new IllegalArgumentException("File size cannot be negative");
}
job.setFileSize(editDTO.getFileSize());
}
}
public void jobReady(String uuid) {