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