feat: Add media details sidebar and date handling features, including media grouping by date
This commit is contained in:
@@ -14,6 +14,8 @@ pub struct MediaResponse {
|
||||
pub hash: String,
|
||||
pub file_url: String,
|
||||
pub thumbnail_url: Option<String>,
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
pub date_taken: Option<chrono::DateTime<chrono::Utc>>,
|
||||
}
|
||||
|
||||
impl From<Media> for MediaResponse {
|
||||
@@ -27,6 +29,8 @@ impl From<Media> for MediaResponse {
|
||||
thumbnail_url: media
|
||||
.thumbnail_path
|
||||
.map(|_| format!("/api/v1/media/{}/thumbnail", media.id)),
|
||||
created_at: media.created_at,
|
||||
date_taken: media.date_taken,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ impl MediaService for MediaServiceImpl {
|
||||
.await
|
||||
.unwrap()?;
|
||||
|
||||
let (storage_path_buf, _date_taken) = get_storage_path_and_date(&extracted_data, &filename);
|
||||
let (storage_path_buf, date_taken) = get_storage_path_and_date(&extracted_data, &filename);
|
||||
|
||||
let storage_path_str = self
|
||||
.persist_media_file(&file_bytes, &storage_path_buf)
|
||||
@@ -81,6 +81,7 @@ impl MediaService for MediaServiceImpl {
|
||||
storage_path_str,
|
||||
hash,
|
||||
file_size,
|
||||
date_taken,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -282,6 +283,7 @@ impl MediaServiceImpl {
|
||||
storage_path: String,
|
||||
hash: String,
|
||||
file_size: i64,
|
||||
date_taken: Option<chrono::DateTime<chrono::Utc>>,
|
||||
) -> CoreResult<Media> {
|
||||
let media_model = Media {
|
||||
id: Uuid::new_v4(),
|
||||
@@ -292,6 +294,7 @@ impl MediaServiceImpl {
|
||||
hash,
|
||||
created_at: chrono::Utc::now(),
|
||||
thumbnail_path: None,
|
||||
date_taken,
|
||||
};
|
||||
|
||||
self.repo.create(&media_model).await?;
|
||||
|
||||
Reference in New Issue
Block a user