fn removeExpense(context: &Context, input: RemoveExpenseInput) -> Result<bool, GraphQLError> {
        let RemoveExpenseInput { expense_id } = input;
        // Check input validity
        let expense_id = match uuid::Uuid::parse_str(expense_id.as_str()) {
            Err(e) => return Err(GraphQLError::InvalidId),
            Ok(u) => u,
        };
        // Delete the expense
        repositories::ExpenseRepository::delete_one(&expense_id, &context.db_pool)
            .map_err(GraphQLError::InternalServerError)
            .map(|_| true)
    }
// FIXME: Extract domain and repository logic to own module
/// Remove an expense. Idempotent mutation.
/// This is a user context dependant mutation.
Extract domain and repository logic to own module
Remove an expense. Idempotent mutation.
This is a user context dependant mutation.
Extract domain and repository logic to own module Remove an expense . Idempotent mutation . This is a user context dependant mutation .
fn removeExpense(context: &Context, input: RemoveExpenseInput) -> Result<bool, GraphQLError> {
        let RemoveExpenseInput { expense_id } = input;
        // Check input validity
        let expense_id = match uuid::Uuid::parse_str(expense_id.as_str()) {
            Err(e) => return Err(GraphQLError::InvalidId),
            Ok(u) => u,
        };
        // Delete the expense
        repositories::ExpenseRepository::delete_one(&expense_id, &context.db_pool)
            .map_err(GraphQLError::InternalServerError)
            .map(|_| true)
    }
fn removeExpense ( context : & Context , input : RemoveExpenseInput ) -> Result < bool , GraphQLError > { let RemoveExpenseInput { expense_id } = input ; // Check input validity let expense_id = match uuid :: Uuid :: parse_str ( expense_id . as_str ( ) ) { Err ( e ) => return Err ( GraphQLError :: InvalidId ) , Ok ( u ) => u , } ; // Delete the expense repositories :: ExpenseRepository :: delete_one ( & expense_id , & context . db_pool ) . map_err ( GraphQLError :: InternalServerError ) . map ( | _ | true ) }
FIXME: Extract domain and repository logic to own module
Remove an expense.
FIXME : Extract domain and repository logic to own module Remove an expense .
context
&Context
input
RemoveExpenseInput
context
&Context
input
RemoveExpenseInput