Structs representing book, and collections model adjusted.

This commit is contained in:
th3r00t
2023-03-12 22:14:26 -04:00
parent 8b1e9cdc72
commit 5098099d57
4 changed files with 31 additions and 17 deletions

8
src/frontend/client/Cargo.lock generated vendored
View File

@@ -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",
]

View File

@@ -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"] }

View File

@@ -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>
</>

View File

@@ -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>,
}