graphql: Add a method to create a group
This commit is contained in:
committed by
nitnelave
parent
8bd1dec180
commit
35ee2834a3
@@ -83,6 +83,21 @@ impl<Handler: BackendHandler + Sync> Mutation<Handler> {
|
||||
.map(Into::into)?)
|
||||
}
|
||||
|
||||
async fn create_group(
|
||||
context: &Context<Handler>,
|
||||
name: String,
|
||||
) -> FieldResult<super::query::Group<Handler>> {
|
||||
if !context.validation_result.is_admin {
|
||||
return Err("Unauthorized group creation".into());
|
||||
}
|
||||
let group_id = context.handler.create_group(&name).await?;
|
||||
Ok(context
|
||||
.handler
|
||||
.get_group_details(group_id)
|
||||
.await
|
||||
.map(Into::into)?)
|
||||
}
|
||||
|
||||
async fn update_user(
|
||||
context: &Context<Handler>,
|
||||
user: UpdateUserInput,
|
||||
|
||||
Reference in New Issue
Block a user