hexagonal refactor

This commit is contained in:
2026-08-01 18:27:22 -04:00
parent 6979cabe8b
commit 188ce23e67
13 changed files with 3590 additions and 1795 deletions
+57
View File
@@ -0,0 +1,57 @@
use thiserror::Error;
#[derive(Debug, Error)]
pub enum DomainError {
#[error("database error: {0}")]
Database(String),
#[error("record not found")]
NotFound,
#[error("record already exists")]
Conflict,
}
pub type DomainResult<T> = Result<T, DomainError>;
#[derive(Clone, Debug)]
pub struct User {
pub id: i64,
pub email: String,
pub display_name: String,
}
#[derive(Clone, Debug)]
pub struct SessionUser {
pub user: User,
pub csrf_token: String,
}
#[derive(Clone, Debug)]
pub struct GroceryList {
pub id: i64,
pub name: String,
pub revision: i64,
}
#[derive(Clone, Debug)]
pub struct Item {
pub id: i64,
pub list_id: i64,
pub name: String,
pub quantity: String,
pub note: String,
pub category_id: Option<i64>,
pub checked: bool,
pub version: i64,
}
#[derive(Clone, Debug)]
pub struct Category {
pub id: i64,
pub name: String,
}
#[derive(Clone, Debug)]
pub struct PresenceUser {
pub user_id: i64,
pub display_name: String,
}