Add tree organization system with categories, tags, and folders
Features: - Categories: Global and team-specific tree categorization (admin-managed) - Tags: Flexible tree tagging with autocomplete (author + admin) - User folders: Personal tree collections with subfolder support - Hierarchical structure (max 3 levels deep) - Right-click context menu for folder management - Cascade delete for subfolders - Filter trees by category, tags, and folder in library view Backend: - New models: Category, Tag, UserFolder with relationships - New API endpoints for categories, tags, and folders - Tree organization migrations (005, 006) Frontend: - FolderSidebar with hierarchical folder tree - FolderEditModal for create/edit with color picker - AddToFolderMenu for quick tree organization - TagInput with autocomplete and TagBadges display - Updated TreeMetadataForm and TreeLibraryPage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
50
frontend/src/api/folders.ts
Normal file
50
frontend/src/api/folders.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import apiClient from './client'
|
||||
import type { Folder, FolderListItem, FolderCreate, FolderUpdate, FolderReorderRequest } from '@/types'
|
||||
|
||||
export const foldersApi = {
|
||||
async list(): Promise<FolderListItem[]> {
|
||||
const response = await apiClient.get<FolderListItem[]>('/folders')
|
||||
return response.data
|
||||
},
|
||||
|
||||
async get(id: string): Promise<Folder> {
|
||||
const response = await apiClient.get<Folder>(`/folders/${id}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async create(data: FolderCreate): Promise<Folder> {
|
||||
const response = await apiClient.post<Folder>('/folders', data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async update(id: string, data: FolderUpdate): Promise<Folder> {
|
||||
const response = await apiClient.put<Folder>(`/folders/${id}`, data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
await apiClient.delete(`/folders/${id}`)
|
||||
},
|
||||
|
||||
async reorder(folderIds: string[]): Promise<void> {
|
||||
await apiClient.post('/folders/reorder', {
|
||||
folder_ids: folderIds,
|
||||
} as FolderReorderRequest)
|
||||
},
|
||||
|
||||
// Folder tree management
|
||||
async getTreeIds(folderId: string): Promise<string[]> {
|
||||
const response = await apiClient.get<string[]>(`/folders/${folderId}/trees`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async addTree(folderId: string, treeId: string): Promise<void> {
|
||||
await apiClient.post(`/folders/${folderId}/trees`, { tree_id: treeId })
|
||||
},
|
||||
|
||||
async removeTree(folderId: string, treeId: string): Promise<void> {
|
||||
await apiClient.delete(`/folders/${folderId}/trees/${treeId}`)
|
||||
},
|
||||
}
|
||||
|
||||
export default foldersApi
|
||||
Reference in New Issue
Block a user