Skip to content
Snippets Groups Projects
Commit c57e1e2c authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

Added adapters for updating and creating tasks

parent 9e071180
No related branches found
No related tags found
No related merge requests found
import { executeApiGet } from './util'; import { executeApiGet, executeApiPost, executeApiPut } from './util';
import { Comment } from './comment'; import { Comment } from './comment';
import { Work } from './work'; import { Work } from './work';
...@@ -77,3 +77,36 @@ export function getTaskWork(uuid: string): Promise<Work[]> { ...@@ -77,3 +77,36 @@ export function getTaskWork(uuid: string): Promise<Work[]> {
})), "Failed to get task work"); })), "Failed to get task work");
} }
interface AddTaskBody {
project: string;
name: string;
text: string;
icon: string;
priority: string;
dependentcies: Array<string>;
requirements: Array<TaskRequirement>;
assigned: Array<TaskAssignment>;
}
export function createTask(task: AddTaskBody): Promise<string> {
return executeApiPost(`task`, task, ({ id }) => id, "Failed to create task");
}
interface UpdateTaskBody {
name?: string;
text?: string;
icon?: string;
priority?: string;
status?: string;
remove_dependentcies?: Array<string>;
remove_requirements?: Array<string>;
remove_assigned?: Array<string>;
add_dependentcies?: Array<string>;
add_requirements?: Array<TaskRequirement>;
add_assigned?: Array<TaskAssignment>;
}
export function updateTask(uuid: string, task: UpdateTaskBody) {
return executeApiPut(`task/${uuid}`, task, () => {}, "Failed to update task");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment