display folders and files into
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user