WP-01: authentication, user management and application shell
Argon2id password hashing, JWT access tokens with rotating HttpOnly refresh cookies and reuse detection, login rate limiting, auth audit log, bootstrap admin, admin-only user CRUD and password reset, OpenAPI spec. Vue login page, auth store with automatic token refresh, route guards, sidebar shell with toasts and placeholder pages, user management page. All tests green: 40 backend, 12 Vitest, 4 Playwright. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
17
backend/crates/infrastructure/src/db.rs
Normal file
17
backend/crates/infrastructure/src/db.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use sqlx::sqlite::{SqlitePool, SqlitePoolOptions};
|
||||
|
||||
pub type DbPool = SqlitePool;
|
||||
|
||||
/// Connect and run migrations. In-memory URLs get a single connection so the schema persists.
|
||||
pub async fn connect(url: &str) -> anyhow::Result<DbPool> {
|
||||
let in_memory = url.contains(":memory:");
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(if in_memory { 1 } else { 5 })
|
||||
.connect(url)
|
||||
.await?;
|
||||
sqlx::query("PRAGMA foreign_keys = ON")
|
||||
.execute(&pool)
|
||||
.await?;
|
||||
sqlx::migrate!("./migrations").run(&pool).await?;
|
||||
Ok(pool)
|
||||
}
|
||||
Reference in New Issue
Block a user