From 962fc592eef304ca65483e1760af5cb640db96b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 1 Sep 2024 16:33:08 +0200 Subject: [PATCH] forgejo-hooks: Introduce chrono dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- forgejo-hooks/Cargo.toml | 1 + forgejo-hooks/src/lib.rs | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/forgejo-hooks/Cargo.toml b/forgejo-hooks/Cargo.toml index 2b8444e..6242844 100644 --- a/forgejo-hooks/Cargo.toml +++ b/forgejo-hooks/Cargo.toml @@ -4,4 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] +chrono = { version = "0.4", default-features = false, features = ["serde"] } serde = { version = "1.0", features = ["derive"] } diff --git a/forgejo-hooks/src/lib.rs b/forgejo-hooks/src/lib.rs index 758ba12..4c35cdc 100644 --- a/forgejo-hooks/src/lib.rs +++ b/forgejo-hooks/src/lib.rs @@ -1,3 +1,4 @@ +use chrono::{DateTime, Utc}; use serde::Deserialize; #[derive(Deserialize, Debug)] @@ -24,7 +25,7 @@ pub struct Commit { pub url: String, pub author: CommitAuthor, pub committer: CommitAuthor, - pub timestamp: String, + pub timestamp: DateTime, } #[derive(Deserialize, Debug)] @@ -59,8 +60,8 @@ pub struct Repository { pub watchers_count: u32, pub open_issues_count: u32, pub default_branch: String, - pub created_at: String, - pub updated_at: String, + pub created_at: DateTime, + pub updated_at: DateTime, } #[derive(Deserialize, Debug)] @@ -91,9 +92,9 @@ pub struct RepositoryFull { pub open_issues_count: u32, pub open_pr_counter: u32, pub default_branch: String, - pub created_at: String, - pub updated_at: String, - pub archived_at: String, + pub created_at: DateTime, + pub updated_at: DateTime, + pub archived_at: DateTime, pub permissions: Perms, pub has_issues: bool, pub internal_tracker: InternalTracker, @@ -114,7 +115,7 @@ pub struct RepositoryFull { pub avatar_url: String, pub internal: bool, pub mirror_internal: String, - pub mirror_updated: String, + pub mirror_updated: DateTime, pub repo_transfer: Option, } @@ -128,8 +129,8 @@ pub struct RepositoryOwner { pub avatar_url: String, pub language: String, pub is_admin: bool, - pub last_login: String, - pub created: String, + pub last_login: DateTime, + pub created: DateTime, pub restricted: bool, pub active: bool, pub prohibit_login: bool,