issue-68 #73

Merged
sebastian merged 3 commits from issue-68 into master 2023-11-18 09:45:22 +01:00
7 changed files with 26 additions and 12 deletions
Showing only changes of commit eb3dba0830 - Show all commits

View File

@ -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"));

View File

@ -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;

View File

@ -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;
}

View File

@ -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>;
}

View File

@ -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,

View File

@ -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);

View File

@ -2236,8 +2236,6 @@ components:
required:
- taskName
- eta
- startDate
- deadline
additionalProperties: false
properties:
taskName: