From 0029c9eab6ee3aa89a053a75b6d27f7fbc48f89c Mon Sep 17 00:00:00 2001 From: Loudbook Date: Tue, 10 Dec 2024 20:24:36 -0500 Subject: [PATCH] Rename to expiresAt --- backend/src/controllers/upload_controller.rs | 2 +- backend/src/delete_service.rs | 2 +- backend/src/models/paste.rs | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/src/controllers/upload_controller.rs b/backend/src/controllers/upload_controller.rs index 61ed386..57002a1 100644 --- a/backend/src/controllers/upload_controller.rs +++ b/backend/src/controllers/upload_controller.rs @@ -69,7 +69,7 @@ pub async fn upload_handler( report_book, wrap, creator_ip: ip.clone(), - expires, + expires_at: expires, }; if let Err(e) = aws_service.put_file(&file_id, (&body).as_ref()).await { diff --git a/backend/src/delete_service.rs b/backend/src/delete_service.rs index 848038f..55ffef2 100644 --- a/backend/src/delete_service.rs +++ b/backend/src/delete_service.rs @@ -51,7 +51,7 @@ impl DeleteHandler { while let Some(paste) = pastes_cursor.next().await { let paste = paste.expect("Failed to get paste"); - if paste.expires > 0 && paste.expires < now as u64 { + if paste.expires_at > 0 && paste.expires_at < now as u64 { deletable_pastes.push(paste.clone()); } diff --git a/backend/src/models/paste.rs b/backend/src/models/paste.rs index 2786c4d..930c642 100644 --- a/backend/src/models/paste.rs +++ b/backend/src/models/paste.rs @@ -9,7 +9,8 @@ pub struct Paste { pub report_book: bool, pub wrap: bool, pub creator_ip: String, - pub expires: u64, + #[serde(rename = "expiresAt")] + pub expires_at: u64, } #[derive(Debug, Serialize, Deserialize, Clone)] @@ -20,7 +21,8 @@ pub struct PasteDTO { pub created: u64, pub report_book: bool, pub wrap: bool, - pub expires: u64, + #[serde(rename = "expiresAt")] + pub expires_at: u64, } impl Paste { @@ -32,7 +34,7 @@ impl Paste { created: self.created, report_book: self.report_book, wrap: self.wrap, - expires: self.expires, + expires_at: self.expires_at, } } }