refactor: Replace Bach with Application on every naming (#292)

This commit is contained in:
Kartikeya Hegde
2023-01-10 18:07:32 +05:30
committed by GitHub
parent aaf7088afc
commit 3cdf50c942
36 changed files with 218 additions and 209 deletions

View File

@ -21,7 +21,7 @@ pub async fn compatibility_api_wrap<'a, 'b, U, T, Q, F, Fut, S, E>(
) -> HttpResponse
where
F: Fn(&'b routes::AppState, U, T) -> Fut,
Fut: Future<Output = RouterResult<api::BachResponse<Q>>>,
Fut: Future<Output = RouterResult<api::ApplicationResponse<Q>>>,
Q: Serialize + std::fmt::Debug + 'a,
S: From<Q> + Serialize,
E: From<errors::ApiErrorResponse> + Serialize + error_stack::Context + actix_web::ResponseError,
@ -29,7 +29,7 @@ where
{
let resp = api::server_wrap_util(state, request, payload, func, api_authentication).await;
match resp {
Ok(api::BachResponse::Json(router_resp)) => {
Ok(api::ApplicationResponse::Json(router_resp)) => {
let pg_resp = S::try_from(router_resp);
match pg_resp {
Ok(pg_resp) => match serde_json::to_string(&pg_resp) {
@ -51,9 +51,9 @@ where
),
}
}
Ok(api::BachResponse::StatusOk) => api::http_response_ok(),
Ok(api::BachResponse::TextPlain(text)) => api::http_response_plaintext(text),
Ok(api::BachResponse::JsonForRedirection(response)) => {
Ok(api::ApplicationResponse::StatusOk) => api::http_response_ok(),
Ok(api::ApplicationResponse::TextPlain(text)) => api::http_response_plaintext(text),
Ok(api::ApplicationResponse::JsonForRedirection(response)) => {
match serde_json::to_string(&response) {
Ok(res) => api::http_redirect_response(res, response),
Err(_) => api::http_response_err(
@ -65,7 +65,7 @@ where
),
}
}
Ok(api::BachResponse::Form(form_data)) => api::build_redirection_form(&form_data)
Ok(api::ApplicationResponse::Form(form_data)) => api::build_redirection_form(&form_data)
.respond_to(request)
.map_into_boxed_body(),
Err(error) => {