[refactor] removed unused api.rs module to streamline code structure

This commit is contained in:
2025-08-20 08:28:22 +02:00
parent af304266a4
commit 7c6724800f
13 changed files with 823 additions and 64 deletions

789
backend-rust/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,28 @@
[package] [workspace]
name = "owly-news" members = ["crates/app", "crates/api"]
version = "0.1.0" resolver = "2"
edition = "2024"
[dependencies] [workspace.package]
edition = "2024"
version = "0.1.0"
[workspace.dependencies]
anyhow = "1.0" anyhow = "1.0"
tokio = { version = "1", features = ["full"] } tokio = "1"
axum = "0.8.4" axum = "0.8.4"
serde = { version = "1.0", features = ["derive"] } serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
sqlx = { version = "0.8", features = ["runtime-tokio", "tls-native-tls", "sqlite", "macros", "migrate", "chrono", "json"] } sqlx = "0.8"
dotenv = "0.15" dotenv = "0.15"
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } tracing-subscriber = "0.3"
toml = "0.9.5" toml = "0.9.5"
unicode-segmentation = "1.12.0"
sha2 = "0.10.9"
hex = "0.4.3"
readability = "0.3.0"
scraper = "0.23.1"
[dev-dependencies] # Dev-only deps centralized (optional; you can also keep these inside each member)
tokio-test = "0.4" tokio-test = "0.4"
axum-test = "17.3" axum-test = "17.3"

7
backend-rust/crates/api/Cargo.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "api"
version = "0.1.0"

View File

@@ -0,0 +1,28 @@
[package]
name = "owly-news-api"
version.workspace = true
edition.workspace = true
[lib]
path = "src/lib.rs"
[dependencies]
anyhow = { workspace = true }
tokio = { workspace = true, features = ["full"] }
axum = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sqlx = { workspace = true, features = ["runtime-tokio", "tls-native-tls", "sqlite", "macros", "migrate", "chrono", "json"] }
dotenv = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
toml = { workspace = true }
unicode-segmentation = { workspace = true }
sha2 = { workspace = true }
hex = { workspace = true }
readability = { workspace = true }
scraper = { workspace = true }
[dev-dependencies]
tokio-test = { workspace = true }
axum-test = { workspace = true }

View File

@@ -17,7 +17,6 @@ use axum::{
http::StatusCode, http::StatusCode,
response::{IntoResponse, Response}, response::{IntoResponse, Response},
}; };
use sqlx::error::DatabaseError;
pub struct AppError(anyhow::Error); pub struct AppError(anyhow::Error);

View File

@@ -0,0 +1,2 @@
pub mod api;
pub use api::*;

View File

@@ -0,0 +1,11 @@
[package]
name = "owly-news"
version.workspace = true
edition.workspace = true
[dependencies]
owly-news-api = { path = "../api" }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
anyhow = "1.0.99"

View File

@@ -0,0 +1,19 @@
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Basic tracing setup (adjust as needed)
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "info".into()),
)
.with(tracing_subscriber::fmt::layer())
.init();
// TODO: invoke your API server bootstrap here.
// For example, if you have a function like `owly-news-api::run_server().await`
// call it here. This is just a placeholder:
tracing::info!("owly-news app starting...");
Ok(())
}

View File

@@ -1,4 +1,3 @@
mod api;
mod config; mod config;
mod db; mod db;
mod models; mod models;

View File

@@ -4,3 +4,4 @@ mod scraping_service;
mod tagging_service; mod tagging_service;
mod analytics_service; mod analytics_service;
mod sharing_service; mod sharing_service;
pub(crate) mod content_processor;