TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.
TypeScript graphviewkanban-boardnodejsproductivityproject-managementself-hostedtasktask-managementtask-managertodoapp
import TvApiBase from "./base"
import type { AppResponse } from "./base.types";
import { type TaskArgAdd, type TaskResponseAdd, type TaskArgDelete, type TaskResponseDelete, type TaskArgUpdate, type TaskResponseUpdate, type TaskResponseFetchById, type TaskArgFetch, type TaskResponseFetch, type TaskArgToggleAssignee, type TaskResponseToggleAssignee, type TaskResponseFetchTaskHistory, type TaskResponseRecoveryTaskHistory, type TaskArgMoveToProject, type TaskResponseMovePreview, type TaskResponseMoveToProject } from "./tasks.api.types"
export default class TvTaskApi extends TvApiBase {
protected moduleUrl = '/module/tasks';
public async fetch(data: TaskArgFetch) {
const params = data.filters
? { ...data, filters: JSON.stringify(data.filters) }
: data;
return this.request(
this.$axios.get<AppResponse<TaskResponseFetch>>(
`${this.moduleUrl}`, { params }
)
);
}
public async fetchTaskById(taskId: number) {
return this.request(
this.$axios.get<AppResponse<TaskResponseFetchById>>(
`${this.moduleUrl}/${taskId}`
)
);
}
public async updateTask(task: TaskArgUpdate) {
return this.request(
this.$axios.patch<AppResponse<TaskResponseUpdate>>(
`${this.moduleUrl}`, task
)
);
}
public async createTask(task: TaskArgAdd) {
return this.request(
this.$axios.post<AppResponse<TaskResponseAdd>>(
`${this.moduleUrl}`, task
)
);
}
public async deleteTask(taskId: TaskArgDelete) {
return this.request(
this.$axios.delete<AppResponse<TaskResponseDelete>>(
`${this.moduleUrl}`, { data: { taskId } }
)
);
}
public async toggleTasksAssignee(data: TaskArgToggleAssignee) {
return this.request(
this.$axios.patch<AppResponse<TaskResponseToggleAssignee>>(
`${this.moduleUrl}/task-users`, data
)
);
}
public async fetchTaskHistory(taskId: number) {
return this.request(
this.$axios.get<AppResponse<TaskResponseFetchTaskHistory>>(
`${this.moduleUrl}/${taskId}/history`
)
);
}
public async recoveryTaskHistory(historyId: number, taskId: number) {
return this.request(
this.$axios.post<AppResponse<TaskResponseRecoveryTaskHistory>>(
`${this.moduleUrl}/${taskId}/restore/${historyId}`
)
);
}
public async movePreview(args: TaskArgMoveToProject) {
return this.request(
this.$axios.get<AppResponse<TaskResponseMovePreview>>(
`${this.moduleUrl}/${args.taskId}/move-preview`, { params: { targetGoalId: args.targetGoalId } }
)
);
}
public async moveToProject(args: TaskArgMoveToProject) {
return this.request(
this.$axios.post<AppResponse<TaskResponseMoveToProject>>(`${this.moduleUrl}/move`, args)
);
}
}