fix(photos): fix SQL type mismatch, pagination panic, missing icons, and add day/month/year grouping

- Fix photos endpoint 500: remove ::uuid cast on user_id WHERE clause (VARCHAR column)
- Fix pagination underflow panic when total_pages is 0
- Add missing 'images' and 'play' icons to SVG icon registry
- Add day/month/year grouping toggle with localStorage persistence
- Improve grid spacing and group header styling per mode
- Add i18n translations for grouping labels (all 9 locales)
This commit is contained in:
Jared Wolff
2026-03-05 14:46:30 -05:00
parent 53e4f5afe6
commit 6a84a5c44e
22 changed files with 220 additions and 64 deletions
@@ -178,7 +178,7 @@ impl FileBlobReadRepository {
FROM storage.files fi
LEFT JOIN storage.folders fo ON fo.id = fi.folder_id
LEFT JOIN storage.file_metadata fm ON fm.file_id = fi.id
WHERE fi.user_id = $1::uuid
WHERE fi.user_id = $1
AND NOT fi.is_trashed
AND (fi.mime_type LIKE 'image/%' OR fi.mime_type LIKE 'video/%')
AND ($2::bigint IS NULL
@@ -198,7 +198,9 @@ impl FileBlobReadRepository {
let mut sort_dates = Vec::with_capacity(rows.len());
for (id, name, fid, fpath, size, mime, ca, ma, uid, sd) in rows {
files.push(Self::row_to_file(id, name, fid, fpath, size, mime, ca, ma, uid)?);
files.push(Self::row_to_file(
id, name, fid, fpath, size, mime, ca, ma, uid,
)?);
sort_dates.push(sd);
}
@@ -100,7 +100,17 @@ impl FileMetadataRepository {
})?;
Ok(row.map(
|(file_id, captured_at, latitude, longitude, camera_make, camera_model, orientation, width, height)| {
|(
file_id,
captured_at,
latitude,
longitude,
camera_make,
camera_model,
orientation,
width,
height,
)| {
StoredMetadata {
file_id,
captured_at,
@@ -152,7 +162,18 @@ impl FileMetadataRepository {
})?;
let mut map = HashMap::with_capacity(rows.len());
for (file_id, captured_at, latitude, longitude, camera_make, camera_model, orientation, width, height) in rows {
for (
file_id,
captured_at,
latitude,
longitude,
camera_make,
camera_model,
orientation,
width,
height,
) in rows
{
map.insert(
file_id.clone(),
StoredMetadata {
+1 -1
View File
@@ -31,9 +31,9 @@ pub use contact_persistence_dto::*;
pub use contact_pg_repository::ContactPgRepository;
pub use device_code_pg_repository::DeviceCodePgRepository;
pub use favorites_pg_repository::FavoritesPgRepository;
pub use file_metadata_repository::FileMetadataRepository;
pub use file_blob_read_repository::FileBlobReadRepository;
pub use file_blob_write_repository::FileBlobWriteRepository;
pub use file_metadata_repository::FileMetadataRepository;
pub use folder_db_repository::FolderDbRepository;
pub use nextcloud_object_id_repository::NextcloudObjectIdRepository;
pub use recent_items_pg_repository::RecentItemsPgRepository;