diff --git a/src/frontend/client/Cargo.lock b/src/frontend/client/Cargo.lock index 4e779d0..9ea8b9b 100644 --- a/src/frontend/client/Cargo.lock +++ b/src/frontend/client/Cargo.lock @@ -35,6 +35,12 @@ version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + [[package]] name = "cfg-if" version = "1.0.0" @@ -45,6 +51,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" name = "client" version = "0.1.0" dependencies = [ + "bytes", + "serde", "yew", ] diff --git a/src/frontend/client/Cargo.toml b/src/frontend/client/Cargo.toml index e0b9f7f..398dc09 100644 --- a/src/frontend/client/Cargo.toml +++ b/src/frontend/client/Cargo.toml @@ -6,4 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +bytes = "1.4.0" +serde = "1.0.155" yew = { version = "0.20", features = ["csr"] } diff --git a/src/frontend/client/src/main.rs b/src/frontend/client/src/main.rs index 4e94b28..3ed7a3f 100644 --- a/src/frontend/client/src/main.rs +++ b/src/frontend/client/src/main.rs @@ -1,11 +1,10 @@ use yew::prelude::*; +mod models; +use models::{Book, Collection}; #[function_component(App)] fn app() -> Html { html! { - //
- //

{ "Hello World!" }

- //
<>
{ "pyShelf V: 0.7.1--dev" }
diff --git a/src/frontend/client/src/models.rs b/src/frontend/client/src/models.rs index 27038a4..c33ca80 100644 --- a/src/frontend/client/src/models.rs +++ b/src/frontend/client/src/models.rs @@ -1,22 +1,27 @@ -struct Book { - id: u32, +use bytes::Bytes; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Book { + book_id: i32, title: String, - author: String, - categories: Vec, - cover: bytes::Bytes, - pages: u32, - progress: u32, + author: Option, + categories: Option, + cover: Option, + pages: Option, + progress: Option, file_name: String, - description: String, + description: Option, date: String, - rights: String, - tags: Vec, - identifier: String, - publisher: String, + rights: Option, + tags: Option, + identifier: Option, + publisher: Option, } -struct Collection { - collection_id: u32, +pub struct Collection { + collection_id: i32, collection: String, books: Vec, }