issue-10 #17

Merged
sebastian merged 29 commits from issue-10 into master 2023-10-22 11:40:25 +02:00
5 changed files with 184 additions and 16 deletions
Showing only changes of commit fd62585a5f - Show all commits

View File

@ -4,18 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Datastructure for Tasks">
<change afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/TaskEditorData.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Implementing edit route for tasks">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/package-lock.json" afterDir="false" />
<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$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -95,7 +85,7 @@
<workItem from="1696399523081" duration="666000" />
<workItem from="1696517800445" duration="3887000" />
<workItem from="1696573678147" duration="111000" />
<workItem from="1697923629354" duration="1218000" />
<workItem from="1697923629354" duration="2959000" />
</task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" />
@ -113,7 +103,15 @@
<option name="project" value="LOCAL" />
<updated>1696233406235</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="Implementing edit route for tasks">
<option name="closed" value="true" />
<created>1697929392755</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1697929392755</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -123,7 +121,8 @@
<MESSAGE value="Structure Taskgroups in Hierarchies" />
<MESSAGE value="Update gitignore for idea folder" />
<MESSAGE value="Datastructure for Tasks" />
<option name="LAST_COMMIT_MESSAGE" value="Datastructure for Tasks" />
<MESSAGE value="Implementing edit route for tasks" />
<option name="LAST_COMMIT_MESSAGE" value="Implementing edit route for tasks" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

View File

@ -87,6 +87,76 @@ export class TaskService {
return httpParams;
}
/**
* edits an existing task
* edits an existing task
* @param taskID internal id of task
* @param taskFieldInfo
* @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 tasksTaskIDPost(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<TaskEntityInfo>;
public tasksTaskIDPost(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<TaskEntityInfo>>;
public tasksTaskIDPost(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<TaskEntityInfo>>;
public tasksTaskIDPost(taskID: number, taskFieldInfo?: TaskFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskID === null || taskID === undefined) {
throw new Error('Required parameter taskID was null or undefined when calling tasksTaskIDPost.');
}
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<TaskEntityInfo>(`${this.configuration.basePath}/tasks/${encodeURIComponent(String(taskID))}`,
taskFieldInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* creates a new task
* creates tasks

View File

@ -28,5 +28,5 @@
<div mat-dialog-actions align="end">
<button mat-raised-button (click)="cancel()">Cancel</button>
<button mat-raised-button color="primary" (click)="submit()">Add Task</button>
<button mat-raised-button color="primary" (click)="submit()">{{editorData.task == undefined? 'Add Task': 'Edit Task'}}</button>
</div>

View File

@ -39,6 +39,7 @@ export class TaskEditorComponent implements OnInit {
}
submit() {
if(this.editorData.task != undefined) {
this.editTask()
} else {
@ -71,6 +72,30 @@ export class TaskEditorComponent implements OnInit {
}
editTask() {
//todo: api call
this.taskService.tasksTaskIDPost(this.editorData.task!.taskID, {
taskName: this.nameCtrl.value,
eta: this.etaCtrl.value,
startDate: this.startDate.value,
deadline: this.endDate.value
}).subscribe({
next: resp => {
this.editorData.task!.taskName = this.nameCtrl.value;
this.editorData.task!.eta = this.etaCtrl.value;
this.editorData.task!.startDate = this.startDate.value;
this.editorData.task!.deadline = this.endDate.value;
this.dialog.close(true);
},
error: err => {
if(err.status == 403) {
this.snackbar.open("No permission", "", {duration: 2000});
} else if(err.status == 404) {
this.snackbar.open("Taskgroup not found", "", {duration: 2000});
} else if(err.status == 409) {
this.snackbar.open("Task already exists", "", {duration: 2000});
} else {
this.snackbar.open("Unexpected error", "", {duration: 3000});
}
}
})
}
}

View File

@ -969,6 +969,80 @@ paths:
example: "failed"
enum:
- "failed"
/tasks/{taskID}:
post:
security:
- API_TOKEN: []
tags:
- task
summary: edits an existing task
description: edits an existing task
parameters:
- name: taskID
in: path
description: internal id of task
required: true
schema:
type: number
example: 1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TaskFieldInfo'
responses:
200:
description: Anfrage erfolgreich
content:
'application/json':
schema:
type: object
$ref: '#/components/schemas/TaskEntityInfo'
403:
description: No permission
content:
'application/json':
schema:
type: object
required:
- status
properties:
status:
type: string
description: Status
example: "failed"
enum:
- "failed"
404:
description: Taskgroup does not exist
content:
'application/json':
schema:
type: object
required:
- status
properties:
status:
type: string
description: Status
example: "failed"
enum:
- "failed"
409:
description: Task already exist
content:
'application/json':
schema:
type: object
required:
- status
properties:
status:
type: string
description: Status
example: "failed"
enum:
- "failed"
components:
securitySchemes: