Drag and drop files between folders
This commit is contained in:
@@ -263,6 +263,24 @@ func (s *Server) handleDeleteFile(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, 200, map[string]string{"status": "deleted"})
|
||||
}
|
||||
|
||||
func (s *Server) handleMoveFile(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
}
|
||||
if err := decodeBody(r, &req); err != nil || req.From == "" || req.To == "" {
|
||||
writeJSON(w, 400, map[string]string{"error": "from and to required"})
|
||||
return
|
||||
}
|
||||
|
||||
userID := getUserID(r)
|
||||
if err := files.MoveFile(s.dataDir, userID, req.From, req.To); err != nil {
|
||||
writeJSON(w, 500, map[string]string{"error": "move failed"})
|
||||
return
|
||||
}
|
||||
writeJSON(w, 200, map[string]string{"status": "moved"})
|
||||
}
|
||||
|
||||
func (s *Server) handleSharedFiles(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO: query permissions table for files shared with this user
|
||||
// For now return empty list
|
||||
|
||||
Reference in New Issue
Block a user