hexagonal refactor
This commit is contained in:
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user