feature/shuffle-sort #30
@@ -59,7 +59,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
|||||||
.filter_map(|t| t.parse().ok())
|
.filter_map(|t| t.parse().ok())
|
||||||
.collect::<Vec<i32>>();
|
.collect::<Vec<i32>>();
|
||||||
|
|
||||||
match filter_mode {
|
return match filter_mode {
|
||||||
FilterMode::Any => dao.get_files_with_any_tag_ids(tag_ids.clone(), exclude_tag_ids),
|
FilterMode::Any => dao.get_files_with_any_tag_ids(tag_ids.clone(), exclude_tag_ids),
|
||||||
FilterMode::All => dao.get_files_with_all_tag_ids(tag_ids.clone(), exclude_tag_ids),
|
FilterMode::All => dao.get_files_with_all_tag_ids(tag_ids.clone(), exclude_tag_ids),
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,13 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
|||||||
"Failed to get files with tag_ids: {:?} with filter_mode: {:?}",
|
"Failed to get files with tag_ids: {:?} with filter_mode: {:?}",
|
||||||
tag_ids, filter_mode
|
tag_ids, filter_mode
|
||||||
))
|
))
|
||||||
|
.inspect(|files| debug!("Found {:?} files", files.len()))
|
||||||
.map(|tagged_files: Vec<String>| {
|
.map(|tagged_files: Vec<String>| {
|
||||||
trace!("Found {:?} tagged files: {:?}", tagged_files.len(), tagged_files);
|
trace!(
|
||||||
|
"Found {:?} tagged files: {:?}",
|
||||||
|
tagged_files.len(),
|
||||||
|
tagged_files
|
||||||
|
);
|
||||||
|
|
||||||
HttpResponse::Ok().json(PhotosResponse {
|
HttpResponse::Ok().json(PhotosResponse {
|
||||||
photos: tagged_files,
|
photos: tagged_files,
|
||||||
|
|||||||
@@ -506,12 +506,16 @@ mod tests {
|
|||||||
fn get_files_with_all_tag_ids(
|
fn get_files_with_all_tag_ids(
|
||||||
&mut self,
|
&mut self,
|
||||||
tag_ids: Vec<i32>,
|
tag_ids: Vec<i32>,
|
||||||
exclude_tag_ids: Vec<i32>,
|
_exclude_tag_ids: Vec<i32>,
|
||||||
) -> anyhow::Result<Vec<String>> {
|
) -> anyhow::Result<Vec<String>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_files_with_any_tag_ids(&mut self, tag_ids: Vec<i32>) -> anyhow::Result<Vec<String>> {
|
fn get_files_with_any_tag_ids(
|
||||||
|
&mut self,
|
||||||
|
_tag_ids: Vec<i32>,
|
||||||
|
_exclude_tag_ids: Vec<i32>,
|
||||||
|
) -> anyhow::Result<Vec<String>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user