refactor: add path for find op

This commit is contained in:
divyam234 2024-07-15 01:23:19 +05:30
parent c49b78b863
commit 826b67210e

View file

@ -272,6 +272,9 @@ func (fs *FileService) ListFiles(userId int64, fquery *schemas.FileQuery) (*sche
if fquery.ParentID != "" {
query.Where("parent_id = ?", fquery.ParentID)
}
if fquery.ParentID == "" && fquery.Path != "" && fquery.Query == "" {
query.Where("parent_id in (SELECT id FROM teldrive.get_file_from_path(?, ?))", fquery.Path, userId)
}
if fquery.Type != "" {
query.Where("type = ?", fquery.Type)
}