feat: restructure project, implement askama templating #26

Merged
theo merged 21 commits from restructure-project into main 2024-07-26 14:42:03 +02:00
37 changed files with 56 additions and 31 deletions
Showing only changes of commit 7d41fbb519 - Show all commits

50
Cargo.lock generated
View File

@ -62,6 +62,17 @@ version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app"
version = "0.1.0"
dependencies = [
"askama",
"askama_axum",
"axum",
"tokio",
"tower-http",
]
[[package]]
name = "askama"
version = "0.12.1"
@ -460,17 +471,6 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "clego"
version = "0.1.0"
dependencies = [
"askama",
"askama_axum",
"axum",
"tokio",
"tower-http",
]
[[package]]
name = "cocoa"
version = "0.25.0"
@ -695,6 +695,18 @@ dependencies = [
"syn 2.0.72",
]
[[package]]
name = "desktop"
version = "0.1.0"
dependencies = [
"app",
"axum",
"tauri",
"tauri-build",
"tokio",
"tower",
]
[[package]]
name = "digest"
version = "0.10.7"
@ -2161,18 +2173,6 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pharmacie-desktop"
version = "0.1.0"
dependencies = [
"axum",
"clego",
"tauri",
"tauri-build",
"tokio",
"tower",
]
[[package]]
name = "phf"
version = "0.8.0"
@ -2919,6 +2919,10 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "sesame-vitale"
version = "0.1.0"
[[package]]
name = "sha2"
version = "0.10.8"

View File

@ -1,6 +1,7 @@
[workspace]
resolver = "2"
members = [
florian_briand marked this conversation as resolved
Review

Packages :

  • tauri/src devient crates/app -> Interfaces et code métier via Axum + Askama + HTMx
  • tauri/src-tauri devient crates/desktop
  • clego devient crates/sesam-vitale
Packages : - `tauri/src` devient `crates/app` -> Interfaces et code métier via Axum + Askama + HTMx - `tauri/src-tauri` devient `crates/desktop` - `clego` devient `crates/sesam-vitale`
"crates/clego",
"crates/tauri"
"crates/app",
"crates/sesame-vitale",
florian_briand marked this conversation as resolved Outdated

J'avais fait le choix de mettre les modules à la racine, plutôt que dans sous dossier crates, car ça vient, à mon goût, surcharger l'arborescence sans qu'on en ai réellement besoin n

J'avais fait le choix de mettre les modules à la racine, plutôt que dans sous dossier crates, car ça vient, à mon goût, surcharger l'arborescence sans qu'on en ai réellement besoin n
Outdated
Review

les deux me vont, on peut partir sur ca

les deux me vont, on peut partir sur ca
"crates/desktop"
]

View File

@ -1,5 +1,5 @@
[package]
name = "clego"
name = "app"
version = "0.1.0"
edition = "2021"

View File

@ -1,4 +1,4 @@
use ::clego::get_router;
use ::app::get_router;
use std::path::Path;
use std::env;

View File

@ -1,5 +1,5 @@
[package]
name = "pharmacie-desktop"
name = "desktop"
version = "0.1.0"
description = "Un logiciel de pharmacie libre et open-source."
authors = ["p4pillon"]
@ -18,5 +18,5 @@ tauri = { version = "2.0.0-beta", features = [] }
tower = "0.4.13"
tokio = "1.39.1"
clego = { path = "../clego" }
app = { path = "../app" }

View File

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

After

Width:  |  Height:  |  Size: 974 B

View File

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

After

Width:  |  Height:  |  Size: 85 KiB

View File

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -45,7 +45,7 @@ pub fn run() {
.expect("Path should be resolvable");
let router = Arc::new(Mutex::new(
clego::get_router(resource_path_buf.as_path()).clone(),
app::get_router(resource_path_buf.as_path()).clone(),
));
// Adds the router to the application state

View File

@ -26,7 +26,7 @@
"bundle": {
"active": true,
"resources": {
"../clego/assets/": "./assets/"
"../app/assets/": "./assets/"
},
"targets": "all",
"icon": [

View File

@ -0,0 +1,6 @@
[package]
name = "sesame-vitale"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}