2020-03-06 15:58:43 +00:00
|
|
|
use crate::{registry, Context, GQLObject, GQLType, QueryError, Result};
|
|
|
|
use graphql_parser::query::Field;
|
2020-03-02 00:24:49 +00:00
|
|
|
use std::borrow::Cow;
|
|
|
|
|
|
|
|
pub struct GQLEmptyMutation;
|
|
|
|
|
|
|
|
impl GQLType for GQLEmptyMutation {
|
|
|
|
fn type_name() -> Cow<'static, str> {
|
|
|
|
Cow::Borrowed("EmptyMutation")
|
|
|
|
}
|
2020-03-03 03:48:00 +00:00
|
|
|
|
2020-03-03 11:15:18 +00:00
|
|
|
fn create_type_info(registry: &mut registry::Registry) -> String {
|
2020-03-04 06:24:44 +00:00
|
|
|
registry.create_type::<Self, _>(|_| registry::Type::Object {
|
2020-03-03 11:15:18 +00:00
|
|
|
name: "EmptyMutation",
|
|
|
|
description: None,
|
2020-03-03 03:48:00 +00:00
|
|
|
fields: Vec::new(),
|
|
|
|
})
|
|
|
|
}
|
2020-03-02 00:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait::async_trait]
|
2020-03-05 09:06:14 +00:00
|
|
|
impl GQLObject for GQLEmptyMutation {
|
|
|
|
fn is_empty() -> bool {
|
|
|
|
return true;
|
|
|
|
}
|
2020-03-06 15:58:43 +00:00
|
|
|
|
|
|
|
async fn resolve_field(&self, _ctx: &Context<'_>, _name: &Field) -> Result<serde_json::Value> {
|
|
|
|
return Err(QueryError::NotConfiguredMutations.into());
|
|
|
|
}
|
2020-03-05 09:06:14 +00:00
|
|
|
}
|