v0.10-frontend-compiles2
This commit is contained in:
@@ -12,7 +12,7 @@ use std::collections::HashMap;
|
||||
use std::net::{IpAddr, Ipv6Addr, SocketAddr};
|
||||
use std::str::FromStr;
|
||||
use tower::ServiceBuilder;
|
||||
use tower_http::cors::CorsLayer;
|
||||
use tower_http::cors::{Any,CorsLayer};
|
||||
use tower_http::trace::TraceLayer;
|
||||
use booksman_orm::{
|
||||
sea_orm::{Database, DatabaseConnection},
|
||||
@@ -144,8 +144,9 @@ pub async fn main() {
|
||||
// it is required to add ".allow_headers([http::header::CONTENT_TYPE])"
|
||||
// or see this issue https://github.com/tokio-rs/axum/issues/849
|
||||
CorsLayer::new()
|
||||
.allow_origin("http://localhost:8080".parse::<HeaderValue>().unwrap())
|
||||
.allow_methods([Method::GET, Method::POST]),
|
||||
.allow_methods([Method::GET, Method::POST])
|
||||
.allow_origin("http://localhost:8080".parse::<HeaderValue>().unwrap())
|
||||
.allow_headers(Any),
|
||||
);
|
||||
|
||||
let sock_addr = SocketAddr::from((
|
||||
@@ -283,6 +284,7 @@ async fn create_book(
|
||||
Extension(ref conn): Extension<DatabaseConnection>,
|
||||
doc_sent : Form<BookUI>,
|
||||
) -> impl IntoResponse {
|
||||
println!("Creating book");
|
||||
let book: book::Model = book::Model{
|
||||
open_library_key: doc_sent.open_library_key.to_owned(),
|
||||
title: (doc_sent.title.to_owned()),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ::entity::entities::{book::Entity as Book};
|
||||
use ::entity::entities::book::Entity as Book;
|
||||
//, book_author::Entity as Author, book_person::Entity as Person, book_place::Entity as Place, book_subject::Entity as Subject, book_time::Entity as Time, book_isbn::Entity as ISBN};
|
||||
use ::entity::entities::{book,book_author,book_person,book_place,book_subject,book_time,book_isbn};
|
||||
//use ::entity::entities::{prelude::*, *};
|
||||
@@ -72,7 +72,7 @@ pub async fn find_books_plus_meta_in_page(
|
||||
Condition::any()
|
||||
.add(book::Column::Id.is_in(book_ids))
|
||||
).find_with_related(Author).all(db).await?;*/
|
||||
let paginator2 = Book::find()
|
||||
let paginator2: Vec<BookAndMeta> = Book::find()
|
||||
.filter(Condition::any()
|
||||
.add(book::Column::Id.is_in(book_ids)))
|
||||
.join(JoinType::LeftJoin, book_author::Relation::Book.def())
|
||||
@@ -81,7 +81,7 @@ pub async fn find_books_plus_meta_in_page(
|
||||
.join(JoinType::LeftJoin, book_subject::Relation::Book.def())
|
||||
.join(JoinType::LeftJoin, book_time::Relation::Book.def())
|
||||
.join(JoinType::LeftJoin, book_isbn::Relation::Book.def())
|
||||
.column_as(book::Column::Id, "id")
|
||||
// .column_as(book::Column::Id, "id")
|
||||
.into_model::<BookAndMeta>()
|
||||
.all(db).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user