diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index baf3bba..19607c2 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -716,3 +716,21 @@ import type { Note as Task } from '../types/note' * auto_consolidate_tasks setting. */ export const consolidateTask = (id: number) => apiPost(`/api/tasks/${id}/consolidate`, {}) + + +// ── Note Versions (pinning) ────────────────────────────────────────────────── + +import type { NoteVersion } from '../types/task' + +/** Mark a note version as manually pinned, optionally with a commit-note + * label. Re-calling with a different label updates the label. */ +export const pinNoteVersion = (noteId: number, versionId: number, label?: string | null) => + apiPost( + `/api/notes/${noteId}/versions/${versionId}/pin`, + { label: label ?? null }, + ) + +/** Downgrade a manually-pinned version back to rolling. Does NOT delete + * the row — older rows may be FIFO-pruned by the next autosave. */ +export const unpinNoteVersion = (noteId: number, versionId: number) => + apiDelete(`/api/notes/${noteId}/versions/${versionId}/pin`) diff --git a/frontend/src/types/task.ts b/frontend/src/types/task.ts index 3d838eb..b7ba893 100644 --- a/frontend/src/types/task.ts +++ b/frontend/src/types/task.ts @@ -31,5 +31,7 @@ export interface NoteVersion { title: string; tags: string[]; body?: string; + pin_kind: "auto" | "manual" | null; + pin_label: string | null; created_at: string; }