diff --git a/entities/src/filter.rs b/entities/src/filter.rs index e844b42..dcdcfe1 100644 --- a/entities/src/filter.rs +++ b/entities/src/filter.rs @@ -35,7 +35,7 @@ use time::{serde::iso8601, OffsetDateTime}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Filter { /// The ID of the Filter in the database. - pub id: String, + pub id: FilterId, /// A title given by the user to name the filter. pub title: String, /// The contexts in which the filter should be applied. @@ -51,6 +51,17 @@ pub struct Filter { pub statuses: Vec, } +/// Wrapper type for a filter ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct FilterId(String); + +impl AsRef for FilterId { + fn as_ref(&self) -> &str { + &self.0 + } +} + /// Represents the various types of Filter contexts #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")]