Refactor /schedules/{scheduleID} endpoints (delete)
All checks were successful
Java CI with Maven / build (push) Successful in 47s
All checks were successful
Java CI with Maven / build (push) Successful in 47s
This commit is contained in:
parent
59aaddf789
commit
d7d8d2060e
@ -4,9 +4,11 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove entityManager from TaskService">
|
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Basic Reschedule">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/test/java/core/schedules/ScheduleServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/schedules/ScheduleServiceTest.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -85,81 +87,82 @@
|
|||||||
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
|
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="JUnit.TaskServiceTest">
|
<component name="RunManager" selected="JUnit.ScheduleServiceTest.deleteSchedule">
|
||||||
<configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="ScheduleRepositoryTest.getAllSchedulesOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="core.tasks.*" />
|
<option name="PATTERN" value="core.schedules.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
<option name="PACKAGE_NAME" value="core.tasks" />
|
<option name="PACKAGE_NAME" value="core.schedules" />
|
||||||
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleRepositoryTest" />
|
||||||
<option name="TEST_OBJECT" value="class" />
|
<option name="METHOD_NAME" value="getAllSchedulesOfUser" />
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="TaskServiceTest.clearTasks" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="demo" />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="core.tasks.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<option name="PACKAGE_NAME" value="core.tasks" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
|
||||||
<option name="METHOD_NAME" value="clearTasks" />
|
|
||||||
<option name="TEST_OBJECT" value="method" />
|
<option name="TEST_OBJECT" value="method" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="TaskServiceTest.deleteTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="ScheduleServiceTest.deleteSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="core.tasks.*" />
|
<option name="PATTERN" value="core.schedules.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
<option name="PACKAGE_NAME" value="core.tasks" />
|
<option name="PACKAGE_NAME" value="core.schedules" />
|
||||||
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
|
||||||
<option name="METHOD_NAME" value="deleteTask" />
|
<option name="METHOD_NAME" value="deleteSchedule" />
|
||||||
<option name="TEST_OBJECT" value="method" />
|
<option name="TEST_OBJECT" value="method" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="TaskServiceTest.finishTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="ScheduleServiceTest.editBasicSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="core.tasks.*" />
|
<option name="PATTERN" value="core.schedules.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
<option name="PACKAGE_NAME" value="core.tasks" />
|
<option name="PACKAGE_NAME" value="core.schedules" />
|
||||||
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
|
||||||
<option name="METHOD_NAME" value="finishTask" />
|
<option name="METHOD_NAME" value="editBasicSchedule" />
|
||||||
<option name="TEST_OBJECT" value="method" />
|
<option name="TEST_OBJECT" value="method" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="TaskServiceTest.loadAllTasks" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="ScheduleServiceTest.getAllSchedulesOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="core.tasks.*" />
|
<option name="PATTERN" value="core.schedules.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
<option name="PACKAGE_NAME" value="core.tasks" />
|
<option name="PACKAGE_NAME" value="core.schedules" />
|
||||||
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
|
||||||
<option name="METHOD_NAME" value="loadAllTasks" />
|
<option name="METHOD_NAME" value="getAllSchedulesOfUser" />
|
||||||
|
<option name="TEST_OBJECT" value="method" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="ScheduleServiceTest.scheduleBasic" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="demo" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="core.schedules.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<option name="PACKAGE_NAME" value="core.schedules" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
|
||||||
|
<option name="METHOD_NAME" value="scheduleBasic" />
|
||||||
<option name="TEST_OBJECT" value="method" />
|
<option name="TEST_OBJECT" value="method" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
@ -174,11 +177,11 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="JUnit.TaskServiceTest" />
|
<item itemvalue="JUnit.ScheduleServiceTest.deleteSchedule" />
|
||||||
<item itemvalue="JUnit.TaskServiceTest.loadAllTasks" />
|
<item itemvalue="JUnit.ScheduleServiceTest.editBasicSchedule" />
|
||||||
<item itemvalue="JUnit.TaskServiceTest.finishTask" />
|
<item itemvalue="JUnit.ScheduleServiceTest.scheduleBasic" />
|
||||||
<item itemvalue="JUnit.TaskServiceTest.clearTasks" />
|
<item itemvalue="JUnit.ScheduleServiceTest.getAllSchedulesOfUser" />
|
||||||
<item itemvalue="JUnit.TaskServiceTest.deleteTask" />
|
<item itemvalue="JUnit.ScheduleRepositoryTest.getAllSchedulesOfUser" />
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
@ -482,17 +485,45 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1699695051881</updated>
|
<updated>1699695051881</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="34" />
|
<task id="LOCAL-00034" summary="Update gitignore and add Clear ScheduleCode">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1699705458914</created>
|
||||||
|
<option name="number" value="00034" />
|
||||||
|
<option name="presentableId" value="LOCAL-00034" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699705458914</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00035" summary="Get All Schedules of User">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1699708881009</created>
|
||||||
|
<option name="number" value="00035" />
|
||||||
|
<option name="presentableId" value="LOCAL-00035" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699708881009</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00036" summary="Get All Schedules of Task + create Basic Schedule">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1699711238266</created>
|
||||||
|
<option name="number" value="00036" />
|
||||||
|
<option name="presentableId" value="LOCAL-00036" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699711238266</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00037" summary="Basic Reschedule">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1699714216432</created>
|
||||||
|
<option name="number" value="00037" />
|
||||||
|
<option name="presentableId" value="LOCAL-00037" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699714216432</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="38" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Fix Foreign Key Constraint Fail when deleting Taskgroups" />
|
|
||||||
<MESSAGE value="Stop and Finish TaskSchedules" />
|
|
||||||
<MESSAGE value="Include TaskScheduleStopResponse" />
|
|
||||||
<MESSAGE value="Fix starting schedule and returning active time of schedule after stop" />
|
|
||||||
<MESSAGE value="Remove update spamming in console" />
|
<MESSAGE value="Remove update spamming in console" />
|
||||||
<MESSAGE value="Start task now from Taskoverview in Dashboard" />
|
<MESSAGE value="Start task now from Taskoverview in Dashboard" />
|
||||||
<MESSAGE value="Load worked minutes when reloading dashboard" />
|
<MESSAGE value="Load worked minutes when reloading dashboard" />
|
||||||
@ -514,31 +545,25 @@
|
|||||||
<MESSAGE value="Deleting Task test" />
|
<MESSAGE value="Deleting Task test" />
|
||||||
<MESSAGE value="Consider increased number of tasks" />
|
<MESSAGE value="Consider increased number of tasks" />
|
||||||
<MESSAGE value="Remove entityManager from TaskService" />
|
<MESSAGE value="Remove entityManager from TaskService" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Remove entityManager from TaskService" />
|
<MESSAGE value="Update gitignore and add Clear ScheduleCode" />
|
||||||
|
<MESSAGE value="Get All Schedules of User" />
|
||||||
|
<MESSAGE value="Get All Schedules of Task + create Basic Schedule" />
|
||||||
|
<MESSAGE value="Basic Reschedule" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Basic Reschedule" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
|
||||||
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
|
|
||||||
<line>87</line>
|
|
||||||
<option name="timeStamp" value="5" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
|
||||||
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
|
|
||||||
<line>94</line>
|
|
||||||
<option name="timeStamp" value="6" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
|
||||||
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
|
|
||||||
<line>202</line>
|
|
||||||
<option name="timeStamp" value="10" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
<url>file://$PROJECT_DIR$/src/main/java/core/entities/User.java</url>
|
<url>file://$PROJECT_DIR$/src/main/java/core/entities/User.java</url>
|
||||||
<line>57</line>
|
<line>57</line>
|
||||||
<option name="timeStamp" value="12" />
|
<option name="timeStamp" value="12" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
|
||||||
|
<line>50</line>
|
||||||
|
<option name="timeStamp" value="32" />
|
||||||
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
|
@ -90,4 +90,19 @@ public class ScheduleController {
|
|||||||
|
|
||||||
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/schedules/{scheduleID}")
|
||||||
|
public ResponseEntity<?> deleteSchedule(@PathVariable long scheduleID) {
|
||||||
|
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.deleteSchedule(permissionResult.getResult());
|
||||||
|
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,4 +51,8 @@ public class TaskScheduleService {
|
|||||||
scheduleRepository.save(schedule);
|
scheduleRepository.save(schedule);
|
||||||
return new ServiceResult<>(schedule);
|
return new ServiceResult<>(schedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteSchedule(AbstractSchedule schedule) {
|
||||||
|
scheduleRepository.delete(schedule);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,4 +95,17 @@ public class ScheduleServiceTest {
|
|||||||
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
||||||
assertNotEquals(((BasicTaskSchedule) result_3.getResult()).getScheduleDate(), oldDate);
|
assertNotEquals(((BasicTaskSchedule) result_3.getResult()).getScheduleDate(), oldDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SqlGroup({
|
||||||
|
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||||
|
@Sql("classpath:taskRepositoryEntries.sql"),
|
||||||
|
@Sql("classpath:basicScheduleEntries.sql")
|
||||||
|
})
|
||||||
|
void deleteSchedule() {
|
||||||
|
for(long i=1; i<=2; i++) {
|
||||||
|
taskScheduleService.deleteSchedule(entityManager.find(BasicTaskSchedule.class, i));
|
||||||
|
assertThat(entityManager.find(BasicTaskSchedule.class, i)).isNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,6 +316,65 @@ export class ScheduleService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deletes schedule
|
||||||
|
* deletes a schedule
|
||||||
|
* @param scheduleID internal id of schedule
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public schedulesScheduleIDDelete(scheduleID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||||
|
public schedulesScheduleIDDelete(scheduleID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||||
|
public schedulesScheduleIDDelete(scheduleID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||||
|
public schedulesScheduleIDDelete(scheduleID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||||
|
if (scheduleID === null || scheduleID === undefined) {
|
||||||
|
throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDDelete.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
let localVarCredential: string | undefined;
|
||||||
|
// authentication (API_TOKEN) required
|
||||||
|
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||||
|
if (localVarCredential) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||||
|
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||||
|
// to determine the Accept header
|
||||||
|
const httpHeaderAccepts: string[] = [
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||||
|
}
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||||
|
if (localVarHttpContext === undefined) {
|
||||||
|
localVarHttpContext = new HttpContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' = 'json';
|
||||||
|
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.delete<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reschedules task
|
* reschedules task
|
||||||
* reschedules a task
|
* reschedules a task
|
||||||
@ -386,69 +445,6 @@ export class ScheduleService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* deletes schedule
|
|
||||||
* deletes a schedule
|
|
||||||
* @param scheduleID internal id of schedule
|
|
||||||
* @param scheduleType internal id of task
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
|
||||||
public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
|
||||||
public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
|
||||||
public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
|
||||||
if (scheduleID === null || scheduleID === undefined) {
|
|
||||||
throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDScheduleTypeDelete.');
|
|
||||||
}
|
|
||||||
if (scheduleType === null || scheduleType === undefined) {
|
|
||||||
throw new Error('Required parameter scheduleType was null or undefined when calling schedulesScheduleIDScheduleTypeDelete.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (API_TOKEN) required
|
|
||||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' = 'json';
|
|
||||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.httpClient.delete<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/${encodeURIComponent(String(scheduleType))}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
withCredentials: this.configuration.withCredentials,
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scheduleID internal id of schedule
|
* @param scheduleID internal id of schedule
|
||||||
* @param finish internal id of schedule
|
* @param finish internal id of schedule
|
||||||
|
@ -38,7 +38,7 @@ export class ScheduleDashboardComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteSchedule(deletedSchedule: ScheduleInfo) {
|
deleteSchedule(deletedSchedule: ScheduleInfo) {
|
||||||
this.scheduleService.schedulesScheduleIDScheduleTypeDelete(deletedSchedule.scheduleID, 'BASIC').subscribe({
|
this.scheduleService.schedulesScheduleIDDelete(deletedSchedule.scheduleID).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
|
this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
|
||||||
},
|
},
|
||||||
|
11
openapi.yaml
11
openapi.yaml
@ -1394,7 +1394,6 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
$ref: "#/components/schemas/SimpleStatusResponse"
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
/schedules/{scheduleID}/{scheduleType}:
|
|
||||||
delete:
|
delete:
|
||||||
security:
|
security:
|
||||||
- API_TOKEN: []
|
- API_TOKEN: []
|
||||||
@ -1410,16 +1409,6 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: number
|
type: number
|
||||||
example: 1
|
example: 1
|
||||||
- name: scheduleType
|
|
||||||
in: path
|
|
||||||
description: internal id of task
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- BASIC
|
|
||||||
- MODERATE
|
|
||||||
- ADVANCED
|
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: operation successfull
|
description: operation successfull
|
||||||
|
Loading…
Reference in New Issue
Block a user