issue-68 #73
@ -11,6 +11,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
 | 
				
			|||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.validation.Valid;
 | 
					import javax.validation.Valid;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -85,6 +86,10 @@ public class TaskController {
 | 
				
			|||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(taskFieldInfo.getStartDate() == null) {
 | 
				
			||||||
 | 
					            taskFieldInfo.setStartDate(LocalDate.now());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ServiceResult<Task> creationResult = taskService.createTask(taskgroupPermissionResult.getResult(), taskFieldInfo);
 | 
					        ServiceResult<Task> creationResult = taskService.createTask(taskgroupPermissionResult.getResult(), taskFieldInfo);
 | 
				
			||||||
        if(creationResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
 | 
					        if(creationResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
 | 
				
			||||||
            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@ package core.api.models.timemanager.tasks;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
					import com.fasterxml.jackson.annotation.JsonFormat;
 | 
				
			||||||
import org.hibernate.validator.constraints.Length;
 | 
					import org.hibernate.validator.constraints.Length;
 | 
				
			||||||
 | 
					import org.springframework.lang.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.validation.constraints.NotBlank;
 | 
					import javax.validation.constraints.NotBlank;
 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,10 +23,10 @@ export interface TaskFieldInfo {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * date from which the task can be started
 | 
					     * date from which the task can be started
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    startDate: string;
 | 
					    startDate?: string;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * date until the task has to be finished
 | 
					     * date until the task has to be finished
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    deadline: string;
 | 
					    deadline?: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -37,5 +37,6 @@ export interface TaskOverviewInfo {
 | 
				
			|||||||
     * number in minutes that was already worked on this task
 | 
					     * number in minutes that was already worked on this task
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    activeTime?: number;
 | 
					    activeTime?: number;
 | 
				
			||||||
 | 
					    taskgroupPath: Array<TaskgroupEntityInfo>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -80,13 +80,14 @@ export class TaskOverviewComponent {
 | 
				
			|||||||
    const dialogRef = this.dialog.open(TaskEditorComponent, {data: editorData, width: "600px"})
 | 
					    const dialogRef = this.dialog.open(TaskEditorComponent, {data: editorData, width: "600px"})
 | 
				
			||||||
    dialogRef.afterClosed().subscribe(res => {
 | 
					    dialogRef.afterClosed().subscribe(res => {
 | 
				
			||||||
      if(res != undefined) {
 | 
					      if(res != undefined) {
 | 
				
			||||||
        const taskOverviewInfo = {
 | 
					        const taskOverviewInfo: TaskOverviewInfo = {
 | 
				
			||||||
          taskID: res.taskID,
 | 
					          taskID: res.taskID,
 | 
				
			||||||
          eta: res.eta,
 | 
					          eta: res.eta,
 | 
				
			||||||
          limit: res.deadline,
 | 
					          limit: res.deadline,
 | 
				
			||||||
          taskName: res.taskName,
 | 
					          taskName: res.taskName,
 | 
				
			||||||
          activeTime: 0,
 | 
					          activeTime: 0,
 | 
				
			||||||
          overdue: res.overdue
 | 
					          overdue: res.overdue,
 | 
				
			||||||
 | 
					          taskgroupPath: []
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.creationEmitter.emit({
 | 
					        this.creationEmitter.emit({
 | 
				
			||||||
          task: taskOverviewInfo,
 | 
					          task: taskOverviewInfo,
 | 
				
			||||||
 | 
				
			|||||||
@ -49,13 +49,21 @@ export class TaskEditorComponent implements OnInit {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  createTask() {
 | 
					  createTask() {
 | 
				
			||||||
    console.log(this.startDate.value)
 | 
					    let endDate_formatted: string|undefined = undefined;
 | 
				
			||||||
    console.log(this.endDate.value)
 | 
					    let startDate_formatted: string|undefined = undefined;
 | 
				
			||||||
 | 
					    if(this.endDate.value.length > 0) {
 | 
				
			||||||
 | 
					      endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(this.startDate.value.length > 0) {
 | 
				
			||||||
 | 
					      startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
 | 
					    this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
 | 
				
			||||||
      taskName: this.nameCtrl.value,
 | 
					      taskName: this.nameCtrl.value,
 | 
				
			||||||
      eta: this.etaCtrl.value,
 | 
					      eta: this.etaCtrl.value,
 | 
				
			||||||
      startDate: moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
 | 
					      startDate: startDate_formatted,
 | 
				
			||||||
      deadline: moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
 | 
					      deadline: endDate_formatted
 | 
				
			||||||
    }).subscribe({
 | 
					    }).subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        this.dialog.close(resp);
 | 
					        this.dialog.close(resp);
 | 
				
			||||||
 | 
				
			|||||||
@ -2236,8 +2236,6 @@ components:
 | 
				
			|||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - taskName
 | 
					        - taskName
 | 
				
			||||||
        - eta
 | 
					        - eta
 | 
				
			||||||
        - startDate
 | 
					 | 
				
			||||||
        - deadline
 | 
					 | 
				
			||||||
      additionalProperties: false
 | 
					      additionalProperties: false
 | 
				
			||||||
      properties:
 | 
					      properties:
 | 
				
			||||||
        taskName:
 | 
					        taskName:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user