2 Commits
Author SHA1 Message Date
sbstp 51dcff1202 fix logging issues
ci/woodpecker/push/e2e Pipeline was successful
ci/woodpecker/push/fmt Pipeline failed
ci/woodpecker/push/test Pipeline was successful
2026-08-01 23:42:26 -04:00
sbstp a7544f837e make list text clickable to toggle 2026-08-01 23:24:13 -04:00
5 changed files with 26 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ Open <http://127.0.0.1:3000>. The application creates `sustenance.db` in the wor
| `COOKIE_SECURE` | `false` | Add the `Secure` attribute to session cookies |
| `REGISTRATION_MODE` | `invite_only` | Use `open` for local development; otherwise registration requires a valid list invitation after the first account |
| `SEED_CONFIG` | `seed.json` | Optional JSON file with a default user to create when the database is first initialized |
| `RUST_LOG` | `sustenance=debug,tower_http=info` | Log filter |
| `RUST_LOG` | `sustenance=info,tower_http=info` | Log filter; HTTP requests are logged at info level |
### Seeding a default user
+11
View File
@@ -34,6 +34,17 @@ test("a user can check off an item", async ({ page }) => {
await expect(row).toHaveClass(/is-checked/);
});
test("clicking an item's text toggles the checkbox", async ({ page }) => {
await registerAndLogin(page, "alice@example.com");
await createList(page, "Weekly shop");
await addItem(page, "Apple");
const row = page.locator(".item-row").filter({ hasText: "Apple" });
await row.locator(".item-copy").click();
await expect(row).toHaveClass(/is-checked/);
});
test("a user can edit an item via the actions modal", async ({ page }) => {
await registerAndLogin(page, "alice@example.com");
await createList(page, "Weekly shop");
+11 -3
View File
@@ -16,8 +16,12 @@ use axum::{
use futures_util::{SinkExt, StreamExt};
use serde::{Deserialize, de::DeserializeOwned};
use thiserror::Error;
use tower_http::{services::ServeDir, set_header::SetResponseHeaderLayer, trace::TraceLayer};
use tracing::{error, warn};
use tower_http::{
services::ServeDir,
set_header::SetResponseHeaderLayer,
trace::{DefaultMakeSpan, DefaultOnResponse, TraceLayer},
};
use tracing::{error, warn, Level};
use crate::domain::{DomainError, SessionUser};
use crate::ports::{HubEvent, RealtimeNotifier};
@@ -104,7 +108,11 @@ pub fn build_router(state: AppState) -> Router {
))
.service(ServeDir::new("static")),
)
.layer(TraceLayer::new_for_http())
.layer(
TraceLayer::new_for_http()
.make_span_with(DefaultMakeSpan::new().level(Level::INFO))
.on_response(DefaultOnResponse::new().level(Level::INFO)),
)
.layer(middleware::from_fn(log_response_status))
.with_state(state)
}
+1 -1
View File
@@ -34,7 +34,7 @@ use crate::sqlite::{
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(
env::var("RUST_LOG").unwrap_or_else(|_| "sustenance=debug,tower_http=info".into()),
env::var("RUST_LOG").unwrap_or_else(|_| "sustenance=info,tower_http=info".into()),
)
.init();
+2 -2
View File
@@ -664,11 +664,11 @@ fn item_row(item: &Item, categories: &[Category], csrf_token: &str) -> Markup {
{
input type="hidden" name="csrf" value=(csrf_token);
input type="hidden" name="checked" value=(next_checked);
button class="check-button" type="submit" aria-label=(if item.checked { "Mark unchecked" } else { "Mark complete" }) {
button id=(format!("item-check-{}", item.id)) class="check-button" type="submit" aria-label=(if item.checked { "Mark unchecked" } else { "Mark complete" }) {
@if item.checked { "" } @else { "" }
}
}
div class="item-copy" {
label class="item-copy" for=(format!("item-check-{}", item.id)) {
@if !item.quantity.is_empty() {
span class="item-qty" { "(" (item.quantity) ")" }
}