replace OpenLibrary calls with BNF calls
This commit is contained in:
parent
fc494d2135
commit
3320d1400c
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ use sea_orm::{ActiveModelTrait, ActiveValue::{NotSet, Set}, ColumnTrait, EntityT
|
|||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::{entities::{book, prelude::{Book}}, utils::open_library};
|
||||
use crate::{entities::{book, prelude::Book}, utils::{bnf}};
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ pub async fn get_book_by_ean(
|
|||
if let Ok(Some(res)) = Book::find().filter(book::Column::Ean.eq(&ean)).one(state.db_conn.as_ref()).await {
|
||||
(StatusCode::OK, Json(Some(res)))
|
||||
} else {
|
||||
let fetched_book = open_library::fetch_book_by_ean(&state.web_client, &ean).await;
|
||||
let fetched_book = bnf::fetch_book_by_ean(&state.web_client, &ean).await;
|
||||
if let Some(book) = fetched_book {
|
||||
let res = Book::insert(book.to_active_model()).exec(state.db_conn.as_ref()).await.unwrap();
|
||||
(StatusCode::OK, Json(Some(book::Model {
|
||||
|
|
|
|||
Reference in a new issue