119 lines
5.2 KiB
Go
119 lines
5.2 KiB
Go
package http
|
|
|
|
// routes.go - HTTP route registration for MapleFile backend
|
|
// This file documents all available endpoints
|
|
|
|
/*
|
|
ROUTE STRUCTURE:
|
|
|
|
Public Routes (No authentication required):
|
|
GET /health - Health check
|
|
GET /version - Version information
|
|
POST /api/v1/auth/register - User registration
|
|
POST /api/v1/auth/login - User login
|
|
POST /api/v1/auth/refresh - Refresh JWT token
|
|
POST /api/v1/auth/logout - Logout
|
|
|
|
Protected Routes (Authentication required):
|
|
|
|
Auth & Profile:
|
|
GET /api/v1/me - Get current user profile
|
|
PUT /api/v1/me - Update user profile
|
|
DELETE /api/v1/me - Delete user account
|
|
POST /api/v1/me/verify - Verify user profile
|
|
|
|
Dashboard:
|
|
GET /api/v1/dashboard - Get dashboard data
|
|
|
|
Invitations:
|
|
POST /api/v1/invites/send-email - Send invitation to non-registered user
|
|
|
|
Collections (Basic CRUD):
|
|
POST /api/v1/collections - Create collection
|
|
GET /api/v1/collections - List user collections
|
|
GET /api/v1/collections/{id} - Get collection by ID
|
|
PUT /api/v1/collections/{id} - Update collection
|
|
DELETE /api/v1/collections/{id} - Delete collection
|
|
|
|
Collections (Hierarchical):
|
|
GET /api/v1/collections/root - Get root collections
|
|
GET /api/v1/collections/parent/{parent_id} - Get collections by parent
|
|
PUT /api/v1/collections/{id}/move - Move collection
|
|
|
|
Collections (Sharing):
|
|
POST /api/v1/collections/{id}/share - Share collection
|
|
DELETE /api/v1/collections/{id}/members/{user_id} - Remove member
|
|
GET /api/v1/collections/shared - List shared collections
|
|
|
|
Collections (Operations):
|
|
PUT /api/v1/collections/{id}/archive - Archive collection
|
|
PUT /api/v1/collections/{id}/restore - Restore collection
|
|
GET /api/v1/collections/filtered - Get filtered collections
|
|
POST /api/v1/collections/sync - Sync collections
|
|
|
|
Files (Basic CRUD):
|
|
POST /api/v1/files/pending - Create pending file
|
|
POST /api/v1/files/{id}/complete - Complete file upload
|
|
GET /api/v1/files/{id} - Get file by ID
|
|
PUT /api/v1/files/{id} - Update file
|
|
DELETE /api/v1/files/{id} - Delete file
|
|
POST /api/v1/files/delete-multiple - Delete multiple files
|
|
|
|
Files (Operations):
|
|
GET /api/v1/files/collection/{collection_id} - List files by collection
|
|
GET /api/v1/files/recent - List recent files
|
|
PUT /api/v1/files/{id}/archive - Archive file
|
|
PUT /api/v1/files/{id}/restore - Restore file
|
|
POST /api/v1/files/sync - Sync files
|
|
|
|
Files (Storage):
|
|
GET /api/v1/files/{id}/upload-url - Get presigned upload URL
|
|
GET /api/v1/files/{id}/download-url - Get presigned download URL
|
|
|
|
Total Endpoints: ~47
|
|
*/
|
|
|
|
// RouteInfo represents information about a route
|
|
type RouteInfo struct {
|
|
Method string
|
|
Path string
|
|
Description string
|
|
Protected bool
|
|
}
|
|
|
|
// GetAllRoutes returns a list of all available routes
|
|
func GetAllRoutes() []RouteInfo {
|
|
return []RouteInfo{
|
|
// Public routes
|
|
{Method: "GET", Path: "/health", Description: "Health check", Protected: false},
|
|
{Method: "GET", Path: "/version", Description: "Version information", Protected: false},
|
|
{Method: "POST", Path: "/api/v1/auth/register", Description: "User registration", Protected: false},
|
|
{Method: "POST", Path: "/api/v1/auth/login", Description: "User login", Protected: false},
|
|
{Method: "POST", Path: "/api/v1/auth/refresh", Description: "Refresh JWT token", Protected: false},
|
|
{Method: "POST", Path: "/api/v1/auth/logout", Description: "Logout", Protected: false},
|
|
|
|
// Profile routes
|
|
{Method: "GET", Path: "/api/v1/me", Description: "Get current user profile", Protected: true},
|
|
{Method: "PUT", Path: "/api/v1/me", Description: "Update user profile", Protected: true},
|
|
{Method: "DELETE", Path: "/api/v1/me", Description: "Delete user account", Protected: true},
|
|
|
|
// Dashboard
|
|
{Method: "GET", Path: "/api/v1/dashboard", Description: "Get dashboard data", Protected: true},
|
|
|
|
// Collections
|
|
{Method: "POST", Path: "/api/v1/collections", Description: "Create collection", Protected: true},
|
|
{Method: "GET", Path: "/api/v1/collections", Description: "List collections", Protected: true},
|
|
{Method: "GET", Path: "/api/v1/collections/{id}", Description: "Get collection", Protected: true},
|
|
{Method: "PUT", Path: "/api/v1/collections/{id}", Description: "Update collection", Protected: true},
|
|
{Method: "DELETE", Path: "/api/v1/collections/{id}", Description: "Delete collection", Protected: true},
|
|
|
|
// Files
|
|
{Method: "POST", Path: "/api/v1/files/pending", Description: "Create pending file", Protected: true},
|
|
{Method: "POST", Path: "/api/v1/files/{id}/complete", Description: "Complete upload", Protected: true},
|
|
{Method: "GET", Path: "/api/v1/files/{id}", Description: "Get file", Protected: true},
|
|
{Method: "PUT", Path: "/api/v1/files/{id}", Description: "Update file", Protected: true},
|
|
{Method: "DELETE", Path: "/api/v1/files/{id}", Description: "Delete file", Protected: true},
|
|
|
|
// ... (More routes will be registered in Phase 6)
|
|
}
|
|
}
|