issue-95 #101
@ -275,4 +275,20 @@ public class ScheduleController {
|
|||||||
|
|
||||||
return ResponseEntity.ok(permissionResult.getResult().toScheduleInfo());
|
return ResponseEntity.ok(permissionResult.getResult().toScheduleInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/schedules/{scheduleID}/stopManual")
|
||||||
|
public ResponseEntity<?> stopManual(@PathVariable long scheduleID, @Valid @RequestBody ManualScheduleStopInfo manualScheduleStopInfo) {
|
||||||
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
|
if(!permissionResult.isHasPermissions()) {
|
||||||
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
|
||||||
|
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||||
|
}
|
||||||
|
|
||||||
|
taskScheduleService.finishScheduleManual(permissionResult.getResult(), manualScheduleStopInfo);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package core.api.models.timemanager.taskSchedule;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public class ManualScheduleStopInfo {
|
||||||
|
@NotNull
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
public LocalDateTime getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package core.services;
|
package core.services;
|
||||||
|
|
||||||
import core.api.models.timemanager.history.PastScheduleInfo;
|
import core.api.models.timemanager.history.PastScheduleInfo;
|
||||||
|
import core.api.models.timemanager.taskSchedule.ManualScheduleStopInfo;
|
||||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleFieldInfo;
|
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleFieldInfo;
|
||||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleInfo;
|
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleInfo;
|
||||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.BasicScheduleFieldInfo;
|
import core.api.models.timemanager.taskSchedule.scheduleInfos.BasicScheduleFieldInfo;
|
||||||
@ -237,4 +238,9 @@ public class TaskScheduleService {
|
|||||||
}
|
}
|
||||||
return filteredSchedules;
|
return filteredSchedules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void finishScheduleManual(AbstractSchedule schedule, ManualScheduleStopInfo manualScheduleStopInfo) {
|
||||||
|
schedule.setStopTime(manualScheduleStopInfo.getEndTime());
|
||||||
|
scheduleRepository.save(schedule);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,11 @@ export class ActiveScheduleComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
abortSchedule() {
|
abortSchedule() {
|
||||||
|
this.scheduleService.schedulesScheduleIDDelete(this.activeSchedule!.scheduleID).subscribe({
|
||||||
|
next: resp => {
|
||||||
|
this.activeSchedule = undefined;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user