fn updatePerson(context: &Context, input: UpdatePersonInput) -> Result<bool, GraphQLError> {
        let UpdatePersonInput {
            person_id,
            name,
            resources,
        } = input;
        // Check input validity
        let person_id = match uuid::Uuid::parse_str(person_id.as_str()) {
            Err(e) => return Err(GraphQLError::InvalidId),
            Ok(u) => u,
        };

        let person = repositories::UpdatePerson {
            id: person_id,
            name,
            resources,
        };
        repositories::PersonRepository::update_one(&person, &context.db_pool)
            .map_err(GraphQLError::InternalServerError)
            .map(|_| true)
    }
// FIXME: Extract domain and repository logic to own module
/// Update a person. Idempotent mutation.
/// This is a user context dependant mutation.
Extract domain and repository logic to own module
Update a person. Idempotent mutation.
This is a user context dependant mutation.
Extract domain and repository logic to own module Update a person . Idempotent mutation . This is a user context dependant mutation .
fn updatePerson(context: &Context, input: UpdatePersonInput) -> Result<bool, GraphQLError> {
        let UpdatePersonInput {
            person_id,
            name,
            resources,
        } = input;
        // Check input validity
        let person_id = match uuid::Uuid::parse_str(person_id.as_str()) {
            Err(e) => return Err(GraphQLError::InvalidId),
            Ok(u) => u,
        };
        let person = repositories::UpdatePerson {
            id: person_id,
            name,
            resources,
        };
        repositories::PersonRepository::update_one(&person, &context.db_pool)
            .map_err(GraphQLError::InternalServerError)
            .map(|_| true)
    }
fn updatePerson ( context : & Context , input : UpdatePersonInput ) -> Result < bool , GraphQLError > { let UpdatePersonInput { person_id , name , resources , } = input ; // Check input validity let person_id = match uuid :: Uuid :: parse_str ( person_id . as_str ( ) ) { Err ( e ) => return Err ( GraphQLError :: InvalidId ) , Ok ( u ) => u , } ; let person = repositories :: UpdatePerson { id : person_id , name , resources , } ; repositories :: PersonRepository :: update_one ( & person , & context . db_pool ) . map_err ( GraphQLError :: InternalServerError ) . map ( | _ | true ) }
FIXME: Extract domain and repository logic to own module
Update a person.
FIXME : Extract domain and repository logic to own module Update a person .
context
&Context
input
UpdatePersonInput
context
&Context
input
UpdatePersonInput