issue-18 #28
@ -5,8 +5,10 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Define Entity BasicTaskSchedule and Taskcontroller">
|
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Define Entity BasicTaskSchedule and Taskcontroller">
|
||||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.html" 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/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.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" />
|
||||||
</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" />
|
||||||
@ -94,7 +96,7 @@
|
|||||||
<workItem from="1697958118995" duration="5749000" />
|
<workItem from="1697958118995" duration="5749000" />
|
||||||
<workItem from="1697969480767" duration="6407000" />
|
<workItem from="1697969480767" duration="6407000" />
|
||||||
<workItem from="1697989716016" duration="3814000" />
|
<workItem from="1697989716016" duration="3814000" />
|
||||||
<workItem from="1698067098771" duration="2794000" />
|
<workItem from="1698067098771" duration="4010000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
@ -67,13 +67,33 @@ public class ScheduleController {
|
|||||||
return ResponseEntity.ok(new BasicTaskScheduleEntityInfo(creationResult.getResult()));
|
return ResponseEntity.ok(new BasicTaskScheduleEntityInfo(creationResult.getResult()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/schedules/{scheduleID}/{scheduleType}")
|
@PostMapping("/schedules/{scheduleID}/basic")
|
||||||
public ResponseEntity<?> editScheduledTask(@PathVariable long scheduleID, @PathVariable ScheduleType scheduleType) {
|
public ResponseEntity<?> editScheduledTask(@PathVariable long scheduleID, @Valid @RequestBody BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
|
||||||
return null;
|
PermissionResult<BasicTaskSchedule> 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.reschedule(permissionResult.getResult(), basicTaskScheduleFieldInfo);
|
||||||
|
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/schedules/{scheduleID}/{scheduleType}")
|
@DeleteMapping("/schedules/{scheduleID}/{scheduleType}")
|
||||||
public ResponseEntity<?> deleteScheduledTask(@PathVariable long scheduleID, @PathVariable ScheduleType scheduleType) {
|
public ResponseEntity<?> deleteScheduledTask(@PathVariable long scheduleID, @PathVariable ScheduleType scheduleType) {
|
||||||
return null;
|
PermissionResult<BasicTaskSchedule> 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.deleteBasicSchedule(permissionResult.getResult());
|
||||||
|
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
package core.repositories.timemanager;
|
package core.repositories.timemanager;
|
||||||
|
|
||||||
import core.entities.timemanager.BasicTaskSchedule;
|
import core.entities.timemanager.BasicTaskSchedule;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSchedule, Long> {
|
public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSchedule, Long> {
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Transactional
|
||||||
|
@Query(value = "DELETE FROM BasicTaskSchedule bts WHERE bts.scheduleID = ?1")
|
||||||
|
void deleteBasicTaskScheduleByID(long id);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import core.repositories.timemanager.TaskRepository;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TaskScheduleService {
|
public class TaskScheduleService {
|
||||||
|
|
||||||
@ -27,4 +29,19 @@ public class TaskScheduleService {
|
|||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
return new ServiceResult<>(basicTaskSchedule);
|
return new ServiceResult<>(basicTaskSchedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PermissionResult<BasicTaskSchedule> getSchedulePermissions(long scheduleID, String name) {
|
||||||
|
Optional<BasicTaskSchedule> basicSchedule = basicTaskScheduleRepository.findById(scheduleID);
|
||||||
|
return basicSchedule.map(value -> new PermissionResult<>(value, value.getTask().getTaskgroup().getUser().getUsername().equals(name))).orElseGet(() ->
|
||||||
|
new PermissionResult<>(ServiceExitCode.MISSING_ENTITY));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reschedule(BasicTaskSchedule basicTaskSchedule, BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
|
||||||
|
basicTaskSchedule.setScheduleDate(basicTaskScheduleFieldInfo.getScheduleDate());
|
||||||
|
basicTaskScheduleRepository.save(basicTaskSchedule);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteBasicSchedule(BasicTaskSchedule basicTaskSchedule) {
|
||||||
|
basicTaskScheduleRepository.deleteBasicTaskScheduleByID(basicTaskSchedule.getScheduleID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ model/passwordChangeRequest.ts
|
|||||||
model/propertiesInfo.ts
|
model/propertiesInfo.ts
|
||||||
model/propertyInfo.ts
|
model/propertyInfo.ts
|
||||||
model/propertyUpdateRequest.ts
|
model/propertyUpdateRequest.ts
|
||||||
|
model/scheduleInfo.ts
|
||||||
model/signUpRequest.ts
|
model/signUpRequest.ts
|
||||||
model/simpleStatusResponse.ts
|
model/simpleStatusResponse.ts
|
||||||
model/taskEntityInfo.ts
|
model/taskEntityInfo.ts
|
||||||
|
@ -20,6 +20,7 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
import { BasicScheduleEntityInfo } from '../model/models';
|
import { BasicScheduleEntityInfo } from '../model/models';
|
||||||
import { BasicScheduleFieldInfo } from '../model/models';
|
import { BasicScheduleFieldInfo } from '../model/models';
|
||||||
|
import { ScheduleInfo } from '../model/models';
|
||||||
import { SimpleStatusResponse } from '../model/models';
|
import { SimpleStatusResponse } from '../model/models';
|
||||||
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
@ -87,6 +88,194 @@ export class ScheduleService {
|
|||||||
return httpParams;
|
return httpParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets all schedules of user
|
||||||
|
* gets all schedules of user
|
||||||
|
* @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 schedulesGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
|
||||||
|
public schedulesGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
|
||||||
|
public schedulesGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
|
||||||
|
public schedulesGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||||
|
|
||||||
|
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.get<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reschedules task
|
||||||
|
* reschedules a task
|
||||||
|
* @param scheduleID internal id of schedule
|
||||||
|
* @param basicScheduleFieldInfo
|
||||||
|
* @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 schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||||
|
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||||
|
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||||
|
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, 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 schedulesScheduleIDBasicPost.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' = 'json';
|
||||||
|
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.post<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/basic`,
|
||||||
|
basicScheduleFieldInfo,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates basic schedule for task
|
* creates basic schedule for task
|
||||||
* creates a basic schedule for a task
|
* creates a basic schedule for a task
|
||||||
|
@ -12,6 +12,7 @@ export * from './passwordChangeRequest';
|
|||||||
export * from './propertiesInfo';
|
export * from './propertiesInfo';
|
||||||
export * from './propertyInfo';
|
export * from './propertyInfo';
|
||||||
export * from './propertyUpdateRequest';
|
export * from './propertyUpdateRequest';
|
||||||
|
export * from './scheduleInfo';
|
||||||
export * from './signUpRequest';
|
export * from './signUpRequest';
|
||||||
export * from './simpleStatusResponse';
|
export * from './simpleStatusResponse';
|
||||||
export * from './taskEntityInfo';
|
export * from './taskEntityInfo';
|
||||||
|
35
frontend/src/api/model/scheduleInfo.ts
Normal file
35
frontend/src/api/model/scheduleInfo.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* API Title
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { BasicScheduleEntityInfo } from './basicScheduleEntityInfo';
|
||||||
|
|
||||||
|
|
||||||
|
export interface ScheduleInfo {
|
||||||
|
/**
|
||||||
|
* internal id of schedule
|
||||||
|
*/
|
||||||
|
scheduleID: number;
|
||||||
|
/**
|
||||||
|
* type of schedule
|
||||||
|
*/
|
||||||
|
scheduleType: ScheduleInfo.ScheduleTypeEnum;
|
||||||
|
schedule: BasicScheduleEntityInfo;
|
||||||
|
}
|
||||||
|
export namespace ScheduleInfo {
|
||||||
|
export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
|
||||||
|
export const ScheduleTypeEnum = {
|
||||||
|
Basic: 'BASIC' as ScheduleTypeEnum,
|
||||||
|
Moderate: 'MODERATE' as ScheduleTypeEnum,
|
||||||
|
Advanced: 'ADVANCED' as ScheduleTypeEnum
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
<p class="basicScheduleContent">{{schedule.scheduleDate | date:'EEEE, d MMM. y'}}</p>
|
<p class="basicScheduleContent">{{schedule.scheduleDate | date:'EEEE, d MMM. y'}}</p>
|
||||||
<div class="basicScheduleContent">
|
<div class="basicScheduleContent">
|
||||||
<button mat-icon-button color="primary"><mat-icon>edit</mat-icon></button>
|
<button mat-icon-button color="primary"><mat-icon>edit</mat-icon></button>
|
||||||
<button mat-icon-button color="warn"><mat-icon>delete</mat-icon></button>
|
<button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
|
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
|
||||||
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-schedule-dashboard',
|
selector: 'app-schedule-dashboard',
|
||||||
@ -13,7 +14,8 @@ export class ScheduleDashboardComponent implements OnInit{
|
|||||||
|
|
||||||
schedules: BasicScheduleEntityInfo[] = []
|
schedules: BasicScheduleEntityInfo[] = []
|
||||||
|
|
||||||
constructor(private scheduleService: ScheduleService) {
|
constructor(private scheduleService: ScheduleService,
|
||||||
|
private snackbar: MatSnackBar) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,4 +26,25 @@ export class ScheduleDashboardComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reschedule() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteSchedule(deletedSchedule: BasicScheduleEntityInfo) {
|
||||||
|
this.scheduleService.schedulesScheduleIDScheduleTypeDelete(deletedSchedule.scheduleID, 'BASIC').subscribe({
|
||||||
|
next: resp => {
|
||||||
|
this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
if(err.status == 403) {
|
||||||
|
this.snackbar.open("No permission", "", {duration: 2000});
|
||||||
|
} else if(err.status == 404) {
|
||||||
|
this.snackbar.open("Schedule not found", "", {duration: 2000});
|
||||||
|
} else {
|
||||||
|
this.snackbar.open("Unexpected error", "",{duration: 2000});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
133
openapi.yaml
133
openapi.yaml
@ -1154,6 +1154,24 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
$ref: "#/components/schemas/SimpleStatusResponse"
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
|
/schedules:
|
||||||
|
get:
|
||||||
|
security:
|
||||||
|
- API_TOKEN: []
|
||||||
|
tags:
|
||||||
|
- schedule
|
||||||
|
description: gets all schedules of user
|
||||||
|
summary: gets all schedules of user
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: request successfull
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/ScheduleInfo'
|
||||||
|
|
||||||
/schedules/{taskID}/{scheduleType}:
|
/schedules/{taskID}/{scheduleType}:
|
||||||
get:
|
get:
|
||||||
security:
|
security:
|
||||||
@ -1246,6 +1264,97 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
$ref: "#/components/schemas/SimpleStatusResponse"
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
|
/schedules/{scheduleID}/basic:
|
||||||
|
post:
|
||||||
|
security:
|
||||||
|
- API_TOKEN: []
|
||||||
|
tags:
|
||||||
|
- schedule
|
||||||
|
description: reschedules a task
|
||||||
|
summary: reschedules task
|
||||||
|
parameters:
|
||||||
|
- name: scheduleID
|
||||||
|
in: path
|
||||||
|
description: internal id of schedule
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: number
|
||||||
|
example: 1
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/BasicScheduleFieldInfo'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: operation successfull
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
403:
|
||||||
|
description: No permission
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
|
404:
|
||||||
|
description: Taskgroup does not exist
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
|
/schedules/{scheduleID}/{scheduleType}:
|
||||||
|
delete:
|
||||||
|
security:
|
||||||
|
- API_TOKEN: []
|
||||||
|
tags:
|
||||||
|
- schedule
|
||||||
|
description: deletes a schedule
|
||||||
|
summary: deletes schedule
|
||||||
|
parameters:
|
||||||
|
- name: scheduleID
|
||||||
|
in: path
|
||||||
|
description: internal id of schedule
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: number
|
||||||
|
example: 1
|
||||||
|
- name: scheduleType
|
||||||
|
in: path
|
||||||
|
description: internal id of task
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- BASIC
|
||||||
|
- MODERATE
|
||||||
|
- ADVANCED
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: operation successfull
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
403:
|
||||||
|
description: No permission
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
|
404:
|
||||||
|
description: Taskgroup does not exist
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||||
components:
|
components:
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
API_TOKEN:
|
API_TOKEN:
|
||||||
@ -1599,4 +1708,26 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
description: date on which the task is scheduled
|
description: date on which the task is scheduled
|
||||||
|
ScheduleInfo:
|
||||||
|
required:
|
||||||
|
- scheduleID
|
||||||
|
- scheduleType
|
||||||
|
- schedule
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
scheduleID:
|
||||||
|
type: number
|
||||||
|
description: internal id of schedule
|
||||||
|
example: 1
|
||||||
|
scheduleType:
|
||||||
|
type: string
|
||||||
|
description: type of schedule
|
||||||
|
example: BASIC
|
||||||
|
enum:
|
||||||
|
- BASIC
|
||||||
|
- MODERATE
|
||||||
|
- ADVANCED
|
||||||
|
schedule:
|
||||||
|
type: object
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/BasicScheduleEntityInfo'
|
||||||
|
Loading…
Reference in New Issue
Block a user