user-auth orm and lib continuation
This commit is contained in:
@@ -1,34 +1,12 @@
|
||||
use ::entity::entities::book::Entity as Book;
|
||||
use ::entity::entities::user::Entity as User;
|
||||
|
||||
//, 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::{book,book_author,book_person,book_place,book_subject,book_time,book_isbn,user};
|
||||
//use ::entity::entities::{prelude::*, *};
|
||||
use sea_orm::*;
|
||||
//use sea_query::Expr;
|
||||
|
||||
#[derive(FromQueryResult,Clone)]
|
||||
pub struct BookAndMeta {
|
||||
pub id: i32,
|
||||
pub open_library_key: String,
|
||||
pub title: String,
|
||||
pub edition_count: i32,
|
||||
pub first_publish_year: i32,
|
||||
pub median_page_count: i32,
|
||||
pub goodread_id: String,
|
||||
pub description: String,
|
||||
pub cover: String,
|
||||
pub location: String,
|
||||
pub time_added: String,
|
||||
pub rating: i32,
|
||||
pub comments: String,
|
||||
pub author_name: String,
|
||||
pub person: String,
|
||||
pub place: String,
|
||||
pub subject: String,
|
||||
pub time: String,
|
||||
pub isbn: String,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BookAndMetaV2 {
|
||||
pub book: book::Model,
|
||||
@@ -48,6 +26,9 @@ impl Query {
|
||||
Book::find_by_id(id).one(db).await
|
||||
}
|
||||
|
||||
pub async fn list_all_users(db: &DbConn) -> Result<Vec<user::Model>, DbErr> {
|
||||
User::find().all(db).await
|
||||
}
|
||||
/* pub async fn find_bookplusmeta_by_id(db: &DbConn, id: i32) -> Result<Option<(book::Model, Vec<book_author::Model>, Vec<book_person::Model>)>, DbErr> {
|
||||
let book = Book::find_by_id(id).one(db).await?.unwrap();
|
||||
let authors = book.find_related(Author).all(db).await?;
|
||||
|
||||
Reference in New Issue
Block a user