use modkit_odata::filter::{FieldKind, FilterField};
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum GroupFilterField {
Type,
HierarchyParentId,
TenantId,
Id,
Name,
}
impl FilterField for GroupFilterField {
const FIELDS: &'static [Self] = &[
Self::Type,
Self::HierarchyParentId,
Self::TenantId,
Self::Id,
Self::Name,
];
fn name(&self) -> &'static str {
match self {
Self::Type => "type",
Self::HierarchyParentId => "hierarchy/parent_id",
Self::TenantId => "tenant_id",
Self::Id => "id",
Self::Name => "name",
}
}
fn kind(&self) -> FieldKind {
match self {
Self::Type | Self::Name => FieldKind::String,
Self::HierarchyParentId | Self::TenantId | Self::Id => FieldKind::Uuid,
}
}
}
#[cfg(test)]
#[path = "groups_tests.rs"]
mod groups_tests;