aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/main.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-23 08:33:06 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-23 08:34:45 +0200
commit2dc74d621399be454abbbff892fb46204ddc6e7b (patch)
treef9525527fc09c465d4e2e4a4f665bfd444b889f8 /crates/rocie-server/src/main.rs
parentfeat: Provide basic barcode handling support (diff)
downloadserver-2dc74d621399be454abbbff892fb46204ddc6e7b.zip
feat(treewide): Add tests and barcode buying/consuming
Diffstat (limited to '')
-rw-r--r--crates/rocie-server/src/main.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/rocie-server/src/main.rs b/crates/rocie-server/src/main.rs
index c896c35..8e71034 100644
--- a/crates/rocie-server/src/main.rs
+++ b/crates/rocie-server/src/main.rs
@@ -22,9 +22,12 @@ async fn main() -> Result<(), std::io::Error> {
api::get::product::products,
api::get::unit::units,
api::get::unit::unit_by_id,
+ api::get::inventory::amount_by_id,
api::set::product::register_product,
api::set::product::associate_barcode,
api::set::unit::register_unit,
+ api::set::barcode::buy_barcode,
+ api::set::barcode::consume_barcode,
),
// security(
// (),
@@ -39,11 +42,13 @@ async fn main() -> Result<(), std::io::Error> {
let args = CliArgs::parse();
match args.command {
- Command::Serve => {
- let host = "127.0.0.1";
- let port = 8080;
+ Command::Serve {
+ host,
+ port,
+ db_path,
+ } => {
let data = Data::new(
- app::App::new()
+ app::App::new(db_path)
.await
.map_err(|err| std::io::Error::other(main::Error::AppInit(err)))?,
);
@@ -52,7 +57,9 @@ async fn main() -> Result<(), std::io::Error> {
HttpServer::new(move || {
App::new()
- .wrap(Logger::new(r#"%a "%r" -> %s %b ("%{Referer}i" "%{User-Agent}i" %T s)"#))
+ .wrap(Logger::new(
+ r#"%a "%r" -> %s %b ("%{Referer}i" "%{User-Agent}i" %T s)"#,
+ ))
.app_data(Data::clone(&data))
.configure(api::get::register_paths)
.configure(api::set::register_paths)