mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-10-01 02:46:57 +08:00
return parent path in search response
This commit is contained in:
parent
1abf2282f2
commit
18df57f8ab
3 changed files with 14 additions and 12 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 := ""
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8412e35ccbbb9fe34c56073158f6f4c1b2a999a7
|
||||
Subproject commit 22e2afa966c7949e8f808de9254351c209347fc1
|
Loading…
Add table
Reference in a new issue