From 2366e0fd8d3a69ec0b01557c3588d70c62967726 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 18 Jan 2019 14:38:08 -0800 Subject: impl cdx timestamps as datetime --- rust/src/database_models.rs | 6 +++--- rust/src/database_schema.rs | 2 +- rust/tests/test_api_server_http.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'rust') diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index ce804c50..7f574893 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -3,7 +3,7 @@ use crate::database_schema::*; use crate::errors::*; use crate::identifiers::uuid2fcid; -use chrono; +use chrono::Utc; use fatcat_api_spec::models::{ ChangelogEntry, Editgroup, EditgroupAnnotation, Editor, EntityEdit, ReleaseRef, }; @@ -307,7 +307,7 @@ pub struct WebcaptureRevCdxRow { pub id: i64, pub webcapture_rev: Uuid, pub surt: String, - pub timestamp: String, + pub timestamp: chrono::DateTime, pub url: String, pub mimetype: Option, pub status_code: Option, @@ -320,7 +320,7 @@ pub struct WebcaptureRevCdxRow { pub struct WebcaptureRevCdxNewRow { pub webcapture_rev: Uuid, pub surt: String, - pub timestamp: String, + pub timestamp: chrono::DateTime, pub url: String, pub mimetype: Option, pub status_code: Option, diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index 0a067a10..69b8c342 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -359,7 +359,7 @@ table! { id -> Int8, webcapture_rev -> Uuid, surt -> Text, - timestamp -> Text, + timestamp -> Timestamptz, url -> Text, mimetype -> Nullable, status_code -> Nullable, diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs index b2f72f4a..66f36a14 100644 --- a/rust/tests/test_api_server_http.rs +++ b/rust/tests/test_api_server_http.rs @@ -694,7 +694,7 @@ fn test_post_webcapture() { "timestamp": "2018-12-28T05:06:07Z", "cdx": [ {"surt": "org,asheesh,)/robots.txt", - "timestamp": "20181228050607", + "timestamp": "2018-12-28T05:06:07Z", "url": "https://asheesh.org/robots.txt", "status_code": 200, "mimetype": "text/html", -- cgit v1.2.3