31 lines
834 B
Rust
31 lines
834 B
Rust
use crate::{registry, Context, GQLObject, GQLType, QueryError, Result};
|
|
use graphql_parser::query::Field;
|
|
use std::borrow::Cow;
|
|
|
|
pub struct GQLEmptyMutation;
|
|
|
|
impl GQLType for GQLEmptyMutation {
|
|
fn type_name() -> Cow<'static, str> {
|
|
Cow::Borrowed("EmptyMutation")
|
|
}
|
|
|
|
fn create_type_info(registry: &mut registry::Registry) -> String {
|
|
registry.create_type::<Self, _>(|_| registry::Type::Object {
|
|
name: "EmptyMutation",
|
|
description: None,
|
|
fields: Vec::new(),
|
|
})
|
|
}
|
|
}
|
|
|
|
#[async_trait::async_trait]
|
|
impl GQLObject for GQLEmptyMutation {
|
|
fn is_empty() -> bool {
|
|
return true;
|
|
}
|
|
|
|
async fn resolve_field(&self, _ctx: &Context<'_>, _name: &Field) -> Result<serde_json::Value> {
|
|
return Err(QueryError::NotConfiguredMutations.into());
|
|
}
|
|
}
|