diff --git a/pkg/schemas/file.go b/pkg/schemas/file.go index 9805184..d0a8cb3 100644 --- a/pkg/schemas/file.go +++ b/pkg/schemas/file.go @@ -46,15 +46,16 @@ type CreateFile struct { } type FileOut struct { - ID string `json:"id"` - Name string `json:"name"` - Type string `json:"type"` - MimeType string `json:"mimeType"` - Path string `json:"path,omitempty"` - Size int64 `json:"size,omitempty"` - Starred bool `json:"starred"` - ParentID string `json:"parentId,omitempty"` - UpdatedAt time.Time `json:"updatedAt,omitempty"` + ID string `json:"id"` + Name string `json:"name"` + Type string `json:"type"` + MimeType string `json:"mimeType"` + Path string `json:"path,omitempty"` + Size int64 `json:"size,omitempty"` + Starred bool `json:"starred"` + ParentID string `json:"parentId,omitempty"` + ParentPath string `json:"parentPath,omitempty"` + UpdatedAt time.Time `json:"updatedAt,omitempty"` } type FileOutFull struct { diff --git a/pkg/services/file.go b/pkg/services/file.go index 6f43fcf..5f60906 100644 --- a/pkg/services/file.go +++ b/pkg/services/file.go @@ -263,7 +263,8 @@ func (fs *FileService) ListFiles(c *gin.Context) (*schemas.FileResponse, *types. } else if fileQuery.Op == "search" { - query.Where("teldrive.get_tsquery(?) @@ teldrive.get_tsvector(name)", fileQuery.Search) + query.Where("teldrive.get_tsquery(?) @@ teldrive.get_tsvector(name)", fileQuery.Search). + Select("*,(select path from teldrive.files as f where f.id = files.parent_id) as parent_path") setOrderFilter(query, &pagingParams, &sortingParams) query.Order(getOrder(sortingParams)) @@ -271,7 +272,7 @@ func (fs *FileService) ListFiles(c *gin.Context) (*schemas.FileResponse, *types. var results []schemas.FileOut - query.Find(&results) + query.Scan(&results) token := "" diff --git a/ui/teldrive-ui b/ui/teldrive-ui index 8412e35..22e2afa 160000 --- a/ui/teldrive-ui +++ b/ui/teldrive-ui @@ -1 +1 @@ -Subproject commit 8412e35ccbbb9fe34c56073158f6f4c1b2a999a7 +Subproject commit 22e2afa966c7949e8f808de9254351c209347fc1