V3 version with backward comp

This commit is contained in:
m
2026-07-28 18:12:56 +02:00
parent 7713835739
commit bd6e7c38f9
48 changed files with 3685 additions and 1344 deletions
+51 -15
View File
@@ -14,29 +14,65 @@ func SetupRoutes(r *gin.Engine, h *Handler, authMiddleware *auth.AuthService) {
api.POST("/auth/login", h.Auth.Login)
api.POST("/auth/refresh", h.Auth.Refresh)
api.POST("/auth/logout", h.Auth.Logout)
api.GET("/files/download/:id", h.File.Download)
api.GET("/thumbnails/:id", h.File.ServeThumbnail)
api.GET("/resources/download/:id", h.Resource.Download)
api.GET("/variants/:id", h.Resource.ServeVariant)
// Protected
protected := api.Group("")
protected.Use(authMiddleware.RequireAuth())
protected.GET("/files", h.File.List)
protected.POST("/files/upload", h.File.Upload)
protected.POST("/files/move", h.File.MoveFiles)
protected.POST("/files/folders", h.File.CreateFolder)
protected.GET("/files/folders", h.File.ListFolders)
protected.GET("/files/folders/:id/files", h.File.ListFilesByParent)
protected.DELETE("/files/:id", h.File.Delete)
protected.GET("/files/:id", h.File.Get)
// Resources (replaces /files)
protected.GET("/resources", h.Resource.List)
protected.POST("/resources/upload", h.Resource.Upload)
protected.POST("/resources/move", h.Resource.MoveResources)
protected.POST("/resources/folders", h.Resource.CreateFolder)
protected.GET("/resources/folders", h.Resource.ListFolders)
protected.GET("/resources/folders/:id/resources", h.Resource.ListByParent)
protected.DELETE("/resources/:id", h.Resource.Delete)
protected.GET("/resources/:id", h.Resource.Get)
protected.POST("/files/:id/tags", h.File.AddTags)
protected.GET("/files/:id/tags", h.File.GetTags)
// Tags on resources
protected.POST("/resources/:id/tags", h.Resource.AddTags)
protected.GET("/resources/:id/tags", h.Resource.GetTags)
// Variants
protected.GET("/resources/:id/variants", h.Resource.GetVariants)
// Dedup check
protected.POST("/resources/dedup-check", h.Resource.CheckDuplicates)
// Sharing (ReBAC)
protected.POST("/resources/:id/share", h.Share.Grant)
protected.DELETE("/resources/:id/share/:userId", h.Share.Revoke)
protected.GET("/resources/:id/share", h.Share.List)
protected.GET("/resources/:id/access", h.Share.Check)
// Device management
protected.GET("/devices", h.Device.List)
protected.POST("/devices", h.Device.Register)
// Placements
protected.GET("/resources/:id/placements", h.Resource.GetVariants)
// Sync
protected.POST("/sync/pull", h.Sync.Pull)
protected.POST("/sync/push", h.Sync.Push)
// OCR
protected.POST("/ocr/jobs", h.OCR.CreateJob)
protected.GET("/ocr/jobs/:id", h.OCR.GetJobStatus)
protected.GET("/files/:id/thumbnails", h.File.GetThumbnails)
protected.POST("/files/dedup-check", h.File.CheckDuplicates)
// Legacy /files/* endpoints (maintain backward compatibility)
protected.GET("/files", h.Resource.List)
protected.POST("/files/upload", h.Resource.Upload)
protected.POST("/files/move", h.Resource.MoveResources)
protected.POST("/files/folders", h.Resource.CreateFolder)
protected.GET("/files/folders", h.Resource.ListFolders)
protected.GET("/files/folders/:id/files", h.Resource.ListByParent)
protected.DELETE("/files/:id", h.Resource.Delete)
protected.GET("/files/:id", h.Resource.Get)
protected.POST("/files/:id/tags", h.Resource.AddTags)
protected.GET("/files/:id/tags", h.Resource.GetTags)
protected.GET("/files/:id/thumbnails", h.Resource.GetVariants)
protected.POST("/files/dedup-check", h.Resource.CheckDuplicates)
}