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"
|
||||
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",
|
||||
]
|
||||
|
||||
|
||||
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
|
||||
|
||||
[dependencies]
|
||||
bytes = "1.4.0"
|
||||
serde = "1.0.155"
|
||||
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::*;
|
||||
mod models;
|
||||
use models::{Book, Collection};
|
||||
|
||||
#[function_component(App)]
|
||||
fn app() -> Html {
|
||||
html! {
|
||||
// <div>
|
||||
// <h1>{ "Hello World!" }</h1>
|
||||
// </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 {
|
||||
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<String>,
|
||||
cover: bytes::Bytes,
|
||||
pages: u32,
|
||||
progress: u32,
|
||||
author: Option<String>,
|
||||
categories: Option<String>,
|
||||
cover: Option<Bytes>,
|
||||
pages: Option<i32>,
|
||||
progress: Option<f32>,
|
||||
file_name: String,
|
||||
description: String,
|
||||
description: Option<String>,
|
||||
date: String,
|
||||
rights: String,
|
||||
tags: Vec<String>,
|
||||
identifier: String,
|
||||
publisher: String,
|
||||
rights: Option<String>,
|
||||
tags: Option<String>,
|
||||
identifier: Option<String>,
|
||||
publisher: Option<String>,
|
||||
}
|
||||
|
||||
struct Collection {
|
||||
collection_id: u32,
|
||||
pub struct Collection {
|
||||
collection_id: i32,
|
||||
collection: String,
|
||||
books: Vec<Book>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user