feat(plan): frontend startPlanning API + store action + task_kind type
This commit is contained in:
@@ -2,7 +2,7 @@ import { ref } from "vue";
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { apiGet, apiPost, apiPut, apiPatch, apiDelete } from "@/api/client";
|
import { apiGet, apiPost, apiPut, apiPatch, apiDelete } from "@/api/client";
|
||||||
import { useToastStore } from "@/stores/toast";
|
import { useToastStore } from "@/stores/toast";
|
||||||
import type { Task, TaskListResponse, TaskStatus, TaskPriority } from "@/types/task";
|
import type { Task, TaskListResponse, TaskStatus, TaskPriority, StartPlanningResult } from "@/types/task";
|
||||||
|
|
||||||
export const useTasksStore = defineStore("tasks", () => {
|
export const useTasksStore = defineStore("tasks", () => {
|
||||||
const tasks = ref<Task[]>([]);
|
const tasks = ref<Task[]>([]);
|
||||||
@@ -129,6 +129,21 @@ export const useTasksStore = defineStore("tasks", () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function startPlanning(
|
||||||
|
projectId: number,
|
||||||
|
title: string
|
||||||
|
): Promise<StartPlanningResult> {
|
||||||
|
try {
|
||||||
|
return await apiPost<StartPlanningResult>("/api/tasks/planning", {
|
||||||
|
project_id: projectId,
|
||||||
|
title,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
useToastStore().show("Failed to start planning", "error");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setStatusFilter(statuses: TaskStatus[]) {
|
function setStatusFilter(statuses: TaskStatus[]) {
|
||||||
statusFilter.value = statuses;
|
statusFilter.value = statuses;
|
||||||
offset.value = 0;
|
offset.value = 0;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export interface Note {
|
|||||||
recurrence_next_spawn_at: string | null;
|
recurrence_next_spawn_at: string | null;
|
||||||
is_task: boolean;
|
is_task: boolean;
|
||||||
note_type: NoteType;
|
note_type: NoteType;
|
||||||
|
task_kind?: "work" | "plan";
|
||||||
metadata: Record<string, string>;
|
metadata: Record<string, string>;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
|
|||||||
@@ -5,6 +5,21 @@ export interface TaskListResponse {
|
|||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StartPlanningResult {
|
||||||
|
task: import("./note").Note;
|
||||||
|
applicable_rules: {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
statement: string;
|
||||||
|
topic_title: string;
|
||||||
|
rulebook_title: string;
|
||||||
|
}[];
|
||||||
|
subscribed_rulebooks: { id: number; title: string }[];
|
||||||
|
applicable_rules_truncated: boolean;
|
||||||
|
project_goal: string;
|
||||||
|
open_task_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TaskLog {
|
export interface TaskLog {
|
||||||
id: number;
|
id: number;
|
||||||
task_id: number;
|
task_id: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user