qm_customer/model/
role.rs

1use async_graphql::SimpleObject;
2use qm_entity::ids::InfraContext;
3use sqlx::FromRow;
4use std::collections::HashMap;
5use std::sync::Arc;
6
7#[derive(Debug, serde::Deserialize)]
8pub struct KeycloakRoleUpdate {
9    pub id: Arc<str>,
10    pub name: Arc<str>,
11    pub realm_id: Option<Arc<str>>,
12}
13
14#[derive(Debug, FromRow)]
15pub struct KcRoleQuery {
16    pub role_id: Option<String>,
17    pub role_name: Option<String>,
18}
19
20#[derive(Debug, Clone, SimpleObject)]
21#[graphql(name = "UserRole")]
22pub struct Role {
23    pub id: Arc<str>,
24    pub name: Arc<str>,
25    #[graphql(skip)]
26    pub context: Option<InfraContext>,
27}
28
29pub type RoleIdMap = HashMap<Arc<str>, Arc<Role>>;
30pub type RoleMap = HashMap<Arc<str>, Arc<Role>>;