Serves as our command endpoint to make changes in a `BankAccount` aggregate.
(
Path(account_id): Path<String>,
State(state): State<ApplicationState>,
CommandExtractor(metadata, command): CommandExtractor,
)
| 24 | |
| 25 | // Serves as our command endpoint to make changes in a `BankAccount` aggregate. |
| 26 | pub async fn command_handler( |
| 27 | Path(account_id): Path<String>, |
| 28 | State(state): State<ApplicationState>, |
| 29 | CommandExtractor(metadata, command): CommandExtractor, |
| 30 | ) -> Response { |
| 31 | match state |
| 32 | .cqrs |
| 33 | .execute_with_metadata(&account_id, command, metadata) |
| 34 | .await |
| 35 | { |
| 36 | Ok(()) => StatusCode::NO_CONTENT.into_response(), |
| 37 | Err(err) => { |
| 38 | println!("Error: {err:#?}\n"); |
| 39 | (StatusCode::BAD_REQUEST, err.to_string()).into_response() |
| 40 | } |
| 41 | } |
| 42 | } |
no test coverage detected
searching dependent graphs…