Skip to main content

qm_keycloak/validation/
model.rs

1use async_graphql::{InputObject, SimpleObject};
2use serde::{Deserialize, Serialize};
3
4/// Input for realm config errors.
5#[derive(Default, Debug, Serialize, Deserialize, SimpleObject, InputObject, Clone)]
6pub struct RealmConfigErrorInput {
7    /// Unique id.
8    pub id: String,
9}
10
11impl From<RealmConfigError> for RealmConfigErrorInput {
12    fn from(value: RealmConfigError) -> Self {
13        Self { id: value.id }
14    }
15}
16
17/// Realm configuration error.
18#[derive(Default, Debug, Serialize, Deserialize, SimpleObject)]
19pub struct RealmConfigError {
20    /// Unique id
21    pub id: String,
22    /// Key to be used for the error message
23    pub key: String,
24}
25
26impl RealmConfigError {
27    /// Creates a new RealmConfigError.
28    pub fn new(id: String, key: String) -> Self {
29        Self { id, key }
30    }
31}