mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 14:51:18 +00:00
feat: ret dir item parent id in dir content query
This commit is contained in:
@@ -24,6 +24,8 @@ type DirectoryInfo struct {
|
|||||||
Kind string `json:"kind" example:"directory"`
|
Kind string `json:"kind" example:"directory"`
|
||||||
// Unique directory identifier
|
// Unique directory identifier
|
||||||
ID string `json:"id" example:"kRp2XYTq9A55"`
|
ID string `json:"id" example:"kRp2XYTq9A55"`
|
||||||
|
// ParentID is the pbulic ID of the directory this directory is in
|
||||||
|
ParentID string `json:"parentId,omitempty" example:"kRp2XYTq9A55"`
|
||||||
// Full path from root (included when ?include=path)
|
// Full path from root (included when ?include=path)
|
||||||
Path virtualfs.Path `json:"path,omitempty"`
|
Path virtualfs.Path `json:"path,omitempty"`
|
||||||
// Directory name
|
// Directory name
|
||||||
@@ -270,6 +272,7 @@ func (h *HTTPHandler) listDirectory(c *fiber.Ctx) error {
|
|||||||
items[i] = FileInfo{
|
items[i] = FileInfo{
|
||||||
Kind: DirItemKindFile,
|
Kind: DirItemKindFile,
|
||||||
ID: child.PublicID,
|
ID: child.PublicID,
|
||||||
|
ParentID: node.PublicID,
|
||||||
Name: child.Name,
|
Name: child.Name,
|
||||||
Size: child.Size,
|
Size: child.Size,
|
||||||
MimeType: child.MimeType,
|
MimeType: child.MimeType,
|
||||||
@@ -384,7 +387,6 @@ func (h *HTTPHandler) deleteDirectory(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
return c.SendStatus(fiber.StatusNoContent)
|
return c.SendStatus(fiber.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// deleteDirectories removes multiple directories
|
// deleteDirectories removes multiple directories
|
||||||
@@ -536,7 +538,12 @@ func (h *HTTPHandler) moveItemsToDirectory(c *fiber.Ctx) error {
|
|||||||
return httperr.Internal(err)
|
return httperr.Internal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
res := moveItemsToDirectoryResponse{}
|
res := moveItemsToDirectoryResponse{
|
||||||
|
Items: make([]any, 0),
|
||||||
|
Moved: make([]string, 0),
|
||||||
|
Conflicts: make([]string, 0),
|
||||||
|
Errors: make([]moveItemError, 0),
|
||||||
|
}
|
||||||
|
|
||||||
for _, node := range result.Moved {
|
for _, node := range result.Moved {
|
||||||
res.Items = append(res.Items, toDirectoryItem(node))
|
res.Items = append(res.Items, toDirectoryItem(node))
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ type FileInfo struct {
|
|||||||
Kind string `json:"kind" example:"file"`
|
Kind string `json:"kind" example:"file"`
|
||||||
// Unique file identifier
|
// Unique file identifier
|
||||||
ID string `json:"id" example:"mElnUNCm8F22"`
|
ID string `json:"id" example:"mElnUNCm8F22"`
|
||||||
|
// ParentID is the pbulic ID of the directory this file is in
|
||||||
|
ParentID string `json:"parentId,omitempty" exmaple:"kRp2XYTq9A55"`
|
||||||
// File name
|
// File name
|
||||||
Name string `json:"name" example:"document.pdf"`
|
Name string `json:"name" example:"document.pdf"`
|
||||||
// File size in bytes
|
// File size in bytes
|
||||||
|
|||||||
Reference in New Issue
Block a user