Refactor and clean up code across multiple modules
- Simplified token type assignment in OAuth service. - Removed unused session_lock module and re-exported Session from zesdex_entities. - Cleaned up session entity by removing unnecessary comments and code. - Consolidated session handling in HTTP handlers for better readability. - Improved formatting and readability in OAuth repository tests. - Enhanced session lock repository with clearer match statements. - Streamlined session repository error handling. - Refined RNG tests for better clarity. - Adjusted module visibility and organization in lib.rs. - Updated IPC client and connection code for better error handling and clarity. - Improved frame handling in IPC for better readability. - Organized module imports and added test utilities for IPC. - Enhanced database connection error handling. - Simplified JWT token creation error handling. - Improved password verification error handling. - Cleaned up state management code for better readability. - Refactored middleware for session authentication and rate limiting. - Simplified clipboard utility for better error handling. - Enhanced logging initialization for better error reporting. - Improved pagination utility with clearer method annotations. - Cleaned up sanitization functions for filenames and paths. - Enhanced slug generation functions for better clarity and usability.
This commit is contained in:
@@ -18,17 +18,13 @@ use crate::domain::memory::Memory;
|
||||
use crate::domain::service::{MemoryService, SettingsService};
|
||||
use crate::domain::settings::Settings;
|
||||
|
||||
use super::dto::{
|
||||
MemoryCreateRequest, MemoryResponse, SettingsResponse, SettingsUpdateRequest,
|
||||
};
|
||||
use super::dto::{MemoryCreateRequest, MemoryResponse, SettingsResponse, SettingsUpdateRequest};
|
||||
|
||||
/// Handle `GET /settings`
|
||||
///
|
||||
/// Returns the current settings as a `SettingsResponse`.
|
||||
pub fn handle_get_settings<S: SettingsService>(service: &S) -> Result<SettingsResponse> {
|
||||
let settings = service
|
||||
.load_settings()
|
||||
.context("failed to load settings")?;
|
||||
let settings = service.load_settings().context("failed to load settings")?;
|
||||
Ok(SettingsResponse::from(settings))
|
||||
}
|
||||
|
||||
@@ -115,9 +111,7 @@ pub fn handle_update_settings<S: SettingsService>(
|
||||
///
|
||||
/// Lists all memory slugs, then loads each memory to return full responses.
|
||||
pub fn handle_list_memories<M: MemoryService>(service: &M) -> Result<Vec<MemoryResponse>> {
|
||||
let slugs = service
|
||||
.list_memories()
|
||||
.context("failed to list memories")?;
|
||||
let slugs = service.list_memories().context("failed to list memories")?;
|
||||
|
||||
// We can't load individual memories without a load_memory method on the
|
||||
// service. For now, list returns summary info; callers who need full
|
||||
|
||||
Reference in New Issue
Block a user