feat(api): GET /files/search (ILIKE substring insensible casse, wildcards échappés, scope owner, q obligatoire)

This commit is contained in:
m
2026-09-10 07:45:53 +02:00
parent 14c058fddb
commit 37ad2d4275
5 changed files with 118 additions and 2 deletions
+12
View File
@@ -89,6 +89,18 @@ func (s *Resources) ListRootFolders(ownerID string) ([]FolderDTO, error) {
return folders, nil
}
func (s *Resources) SearchFiles(ownerID, q string, page, pageSize int) ([]FileDTO, int, error) {
rows, total, err := s.Repo.SearchFiles(ownerID, q, pageSize, (page-1)*pageSize)
if err != nil {
return nil, 0, err
}
files := make([]FileDTO, 0, len(rows))
for _, row := range rows {
files = append(files, toFileDTO(row))
}
return files, total, nil
}
// Upload persists the multipart-sourced file under UploadDir/<device> and
// records its metadata, returning the FileDTO. The physical file is removed
// if metadata persistence fails (e.g. name conflict).