display folders and files into

This commit is contained in:
m
2026-07-13 17:09:39 +02:00
parent 04b6dfc6d4
commit 93100a2b81
4 changed files with 24 additions and 5 deletions
+10
View File
@@ -242,3 +242,13 @@ func (h *FileHandler) CreateFolder(c *gin.Context) {
api.Success(c, folder)
}
func (h *FileHandler) ListFilesByParent(c *gin.Context) {
parentID := c.Param("id")
files, err := h.files.ListFilesByParentID(parentID)
if err != nil {
api.Error(c, http.StatusInternalServerError, "DB_ERROR", "Failed to list files in folder")
return
}
api.Success(c, files)
}
+1
View File
@@ -12,6 +12,7 @@ func SetupRoutes(r *gin.Engine, h *Handler) {
api.POST("/files/move", h.File.MoveFiles)
api.POST("/files/folders", h.File.CreateFolder)
api.GET("/files/folders", h.File.ListFolders)
api.GET("/files/folders/:id/files", h.File.ListFilesByParent)
api.GET("/files/download/:id", h.File.Download)
api.DELETE("/files/:id", h.File.Delete)
api.GET("/files/:id", h.File.Get)