diff options
| author | soryu <soryu@soryu.co> | 2026-04-28 19:12:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-28 19:12:52 +0100 |
| commit | d1fdfb140cc440664f77a24886172f9976a05a31 (patch) | |
| tree | 454739f80dde60fc6c1cd97acbaef3223ac041c6 /makima/src/db/repository.rs | |
| parent | 636694182fe9381479f2e9062229dda3838c5421 (diff) | |
| download | soryu-d1fdfb140cc440664f77a24886172f9976a05a31.tar.gz soryu-d1fdfb140cc440664f77a24886172f9976a05a31.zip | |
feat: revert broken directive PRs, re-implement Lexical document orchestrator (#98)
* feat: soryu-co/soryu - makima: Revert broken directive PRs and verify clean build
* feat: soryu-co/soryu - makima: Re-implement frontend: Lexical document editor with feature flag and base components
* WIP: heartbeat checkpoint
* feat: soryu-co/soryu - makima: Add contract blocks, expandable log rows, and interaction controls
* WIP: heartbeat checkpoint
* feat: soryu-co/soryu - makima: End-to-end build verification and integration polish
Diffstat (limited to 'makima/src/db/repository.rs')
| -rw-r--r-- | makima/src/db/repository.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs index 10633d5..5a912e4 100644 --- a/makima/src/db/repository.rs +++ b/makima/src/db/repository.rs @@ -21,7 +21,6 @@ use super::models::{ PhaseDefinition, SupervisorHeartbeatRecord, SupervisorState, Task, TaskCheckpoint, TaskEvent, TaskSummary, UpdateContractRequest, UpdateFileRequest, UpdateTaskRequest, UpdateTemplateRequest, - UserSetting, }; /// Repository error types. @@ -4912,7 +4911,6 @@ pub async fn sync_supervisor_state( // ============================================================================= /// Helper to truncate string to max length -#[allow(dead_code)] fn truncate_string(s: &str, max_len: usize) -> String { if s.len() <= max_len { s.to_string() @@ -6700,9 +6698,11 @@ pub async fn get_available_orders_for_dog_pickup( .await } -// ─── User Settings ─────────────────────────────────────────────────────────── +// ============================================================================= +// User Settings +// ============================================================================= -/// Get all settings for a given owner. +/// Get all settings for a user. pub async fn get_user_settings( pool: &PgPool, owner_id: Uuid, @@ -6720,7 +6720,7 @@ pub async fn get_user_settings( .await } -/// Get a single setting by owner and key. +/// Get a specific setting by key for a user. pub async fn get_user_setting( pool: &PgPool, owner_id: Uuid, @@ -6739,7 +6739,7 @@ pub async fn get_user_setting( .await } -/// Upsert a user setting (insert or update on conflict). +/// Upsert (create or update) a user setting. pub async fn upsert_user_setting( pool: &PgPool, owner_id: Uuid, @@ -6750,8 +6750,9 @@ pub async fn upsert_user_setting( r#" INSERT INTO user_settings (owner_id, key, value) VALUES ($1, $2, $3) - ON CONFLICT (owner_id, key) DO UPDATE - SET value = EXCLUDED.value, updated_at = now() + ON CONFLICT (owner_id, key) DO UPDATE SET + value = EXCLUDED.value, + updated_at = NOW() RETURNING id, owner_id, key, value, created_at, updated_at "#, ) @@ -6762,7 +6763,7 @@ pub async fn upsert_user_setting( .await } -/// Delete a user setting. Returns true if a row was deleted. +/// Delete a user setting by key. Returns true if a row was deleted. pub async fn delete_user_setting( pool: &PgPool, owner_id: Uuid, @@ -6778,6 +6779,7 @@ pub async fn delete_user_setting( .bind(key) .execute(pool) .await?; + Ok(result.rows_affected() > 0) } |
