feat(frontend): NoteVersion pin fields + pin/unpin client helpers
This commit is contained in:
@@ -716,3 +716,21 @@ import type { Note as Task } from '../types/note'
|
|||||||
* auto_consolidate_tasks setting. */
|
* auto_consolidate_tasks setting. */
|
||||||
export const consolidateTask = (id: number) =>
|
export const consolidateTask = (id: number) =>
|
||||||
apiPost<Task>(`/api/tasks/${id}/consolidate`, {})
|
apiPost<Task>(`/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<NoteVersion>(
|
||||||
|
`/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`)
|
||||||
|
|||||||
@@ -31,5 +31,7 @@ export interface NoteVersion {
|
|||||||
title: string;
|
title: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
body?: string;
|
body?: string;
|
||||||
|
pin_kind: "auto" | "manual" | null;
|
||||||
|
pin_label: string | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user