Change return type of createUser to ID

This commit is contained in:
Elias Schriefer 2021-10-17 16:58:04 +00:00
parent b46715650b
commit 8d67300d5f

View File

@ -397,7 +397,7 @@ pub struct Mutation;
#[graphql_object(context = Context)]
impl Mutation {
async fn createUser(context: &Context, new_user: NewUser) -> FieldResult<String> {
async fn createUser(context: &Context, new_user: NewUser) -> FieldResult<ID> {
let user: User = new_user.into();
if sqlx::query(
@ -475,7 +475,7 @@ impl Mutation {
external_servers_privacy_preferences.info_server_limit.iter().map(|u| u.to_string()).collect::<Vec<_>>().join(","),
).as_str()).execute(&context.db).await?;
Ok(format!("User @{} created", user.user_name))
Ok(ID::new(id_to_uuid(&user.id)?.to_simple().to_string()))
}
}