恢复 Vue TypeScript 生产构建,补齐可运行页面壳子,并修复文件树与 SSE 状态问题。 按 FastAPI Wire Contract 统一 Service DTO 映射,同时补充前端开发说明和问题修复复盘。
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import apiClient from './apiClient'
|
|
import type { ApiNote, ApiNoteSummary, OperationResponse, PageMeta } from '@/contracts'
|
|
|
|
export async function listNotes(params?: {
|
|
folder?: string
|
|
tag?: string
|
|
limit?: number
|
|
offset?: number
|
|
}): Promise<{ items: ApiNoteSummary[]; page: PageMeta }> {
|
|
return apiClient.get('/api/notes', { params })
|
|
}
|
|
|
|
export async function getNote(noteId: string): Promise<ApiNote> {
|
|
return apiClient.get(`/api/notes/${noteId}`)
|
|
}
|
|
|
|
export async function createNote(data: {
|
|
title: string
|
|
folder?: string
|
|
markdown?: string
|
|
tags?: string[]
|
|
}): Promise<ApiNote> {
|
|
return apiClient.post('/api/notes', data)
|
|
}
|
|
|
|
export async function updateNote(
|
|
noteId: string,
|
|
data: { title?: string; markdown?: string; tags?: string[] }
|
|
): Promise<ApiNote> {
|
|
return apiClient.patch(`/api/notes/${noteId}`, data)
|
|
}
|
|
|
|
export async function deleteNote(noteId: string): Promise<OperationResponse> {
|
|
return apiClient.delete(`/api/notes/${noteId}`)
|
|
}
|
|
|
|
export async function moveNote(noteId: string, folder: string): Promise<ApiNote> {
|
|
return apiClient.post(`/api/notes/${noteId}/move`, { folder })
|
|
}
|