feat: add date_taken field to media model and update related functionalities
This commit is contained in:
@@ -50,7 +50,7 @@ impl MediaRepository for PostgresMediaRepository {
|
||||
PostgresMedia,
|
||||
r#"
|
||||
SELECT id, owner_id, storage_path, original_filename, mime_type, hash, created_at,
|
||||
extracted_location, width, height
|
||||
extracted_location, width, height, date_taken
|
||||
FROM media
|
||||
WHERE hash = $1
|
||||
"#,
|
||||
@@ -68,7 +68,7 @@ impl MediaRepository for PostgresMediaRepository {
|
||||
PostgresMedia,
|
||||
r#"
|
||||
SELECT id, owner_id, storage_path, original_filename, mime_type, hash, created_at,
|
||||
extracted_location, width, height
|
||||
extracted_location, width, height, date_taken
|
||||
FROM media
|
||||
WHERE id = $1
|
||||
"#,
|
||||
@@ -86,7 +86,7 @@ impl MediaRepository for PostgresMediaRepository {
|
||||
PostgresMedia,
|
||||
r#"
|
||||
SELECT id, owner_id, storage_path, original_filename, mime_type, hash, created_at,
|
||||
extracted_location, width, height
|
||||
extracted_location, width, height, date_taken
|
||||
FROM media
|
||||
WHERE owner_id = $1
|
||||
"#,
|
||||
@@ -105,17 +105,19 @@ impl MediaRepository for PostgresMediaRepository {
|
||||
width: Option<i32>,
|
||||
height: Option<i32>,
|
||||
location: Option<String>,
|
||||
date_taken: Option<chrono::DateTime<chrono::Utc>>,
|
||||
) -> CoreResult<()> {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
UPDATE media
|
||||
SET width = $2, height = $3, extracted_location = $4
|
||||
SET width = $2, height = $3, extracted_location = $4, date_taken = $5
|
||||
WHERE id = $1
|
||||
"#,
|
||||
id,
|
||||
width,
|
||||
height,
|
||||
location
|
||||
location,
|
||||
date_taken
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user