From 06caec85b37e7fd6842610af92076873768f7552 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Mon, 9 Jan 2023 07:54:07 -0500 Subject: [PATCH] Add ID type for reports --- entities/src/report.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/entities/src/report.rs b/entities/src/report.rs index bc4c7ea..89bbc4c 100644 --- a/entities/src/report.rs +++ b/entities/src/report.rs @@ -6,7 +6,18 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Report { /// The ID of the report. - pub id: String, + pub id: ReportId, /// The action taken in response to the report. pub action_taken: String, } + +/// Wrapper type for a report ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct ReportId(String); + +impl AsRef for ReportId { + fn as_ref(&self) -> &str { + &self.0 + } +}