mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Structs representing book, and collections model adjusted.
This commit is contained in:
8
src/frontend/client/Cargo.lock
generated
vendored
8
src/frontend/client/Cargo.lock
generated
vendored
@@ -35,6 +35,12 @@ version = "3.12.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
|
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytes"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -45,6 +51,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
name = "client"
|
name = "client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"serde",
|
||||||
"yew",
|
"yew",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
2
src/frontend/client/Cargo.toml
vendored
2
src/frontend/client/Cargo.toml
vendored
@@ -6,4 +6,6 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bytes = "1.4.0"
|
||||||
|
serde = "1.0.155"
|
||||||
yew = { version = "0.20", features = ["csr"] }
|
yew = { version = "0.20", features = ["csr"] }
|
||||||
|
|||||||
5
src/frontend/client/src/main.rs
vendored
5
src/frontend/client/src/main.rs
vendored
@@ -1,11 +1,10 @@
|
|||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
|
mod models;
|
||||||
|
use models::{Book, Collection};
|
||||||
|
|
||||||
#[function_component(App)]
|
#[function_component(App)]
|
||||||
fn app() -> Html {
|
fn app() -> Html {
|
||||||
html! {
|
html! {
|
||||||
// <div>
|
|
||||||
// <h1>{ "Hello World!" }</h1>
|
|
||||||
// </div>
|
|
||||||
<>
|
<>
|
||||||
<div>{ "pyShelf V: 0.7.1--dev" }</div>
|
<div>{ "pyShelf V: 0.7.1--dev" }</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
33
src/frontend/client/src/models.rs
vendored
33
src/frontend/client/src/models.rs
vendored
@@ -1,22 +1,27 @@
|
|||||||
struct Book {
|
use bytes::Bytes;
|
||||||
id: u32,
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct Book {
|
||||||
|
book_id: i32,
|
||||||
title: String,
|
title: String,
|
||||||
author: String,
|
author: Option<String>,
|
||||||
categories: Vec<String>,
|
categories: Option<String>,
|
||||||
cover: bytes::Bytes,
|
cover: Option<Bytes>,
|
||||||
pages: u32,
|
pages: Option<i32>,
|
||||||
progress: u32,
|
progress: Option<f32>,
|
||||||
file_name: String,
|
file_name: String,
|
||||||
description: String,
|
description: Option<String>,
|
||||||
date: String,
|
date: String,
|
||||||
rights: String,
|
rights: Option<String>,
|
||||||
tags: Vec<String>,
|
tags: Option<String>,
|
||||||
identifier: String,
|
identifier: Option<String>,
|
||||||
publisher: String,
|
publisher: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Collection {
|
pub struct Collection {
|
||||||
collection_id: u32,
|
collection_id: i32,
|
||||||
collection: String,
|
collection: String,
|
||||||
books: Vec<Book>,
|
books: Vec<Book>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user