-
Notifications
You must be signed in to change notification settings - Fork 4
feat/delete all kv #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/delete all kv #125
Conversation
WalkthroughPCR history entries appended to development and production history files. A new bulk delete feature for user key-value pairs is implemented across the database, service, and API layers, introducing a DELETE endpoint and supporting functions to remove all KV entries for a given user. Changes
Sequence DiagramsequenceDiagram
actor Client
participant API as DELETE /protected/kv
participant AppState
participant kv as kv::delete_all()
participant DB as UserKV::delete_all_for_user()
participant Postgres
Client->>API: DELETE request + encrypted body
API->>API: Decrypt request (middleware)
API->>AppState: delete_all(user_id)
AppState->>kv: delete_all(pool, user_id)
kv->>kv: Acquire DB connection
kv->>DB: delete_all_for_user(conn, user_id)
DB->>Postgres: DELETE FROM user_kv WHERE user_id = ?
Postgres-->>DB: Rows deleted
DB-->>kv: Result<(), Error>
kv-->>AppState: StoreResult<()>
AppState-->>API: Result
API->>API: Encrypt response
API-->>Client: JSON response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (4)src/models/user_kv.rs (5)
src/main.rs (1)
src/web/protected_routes.rs (4)
src/kv.rs (2)
⏰ Context from checks skipped due to timeout of 100000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
Comment |
Greptile OverviewGreptile SummaryThis PR adds a new endpoint to delete all key-value pairs for an authenticated user. The implementation follows the same pattern as the existing
The implementation is clean, follows established patterns in the codebase, and properly leverages the authentication middleware to ensure users can only delete their own data. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant API as Protected Routes
participant AppState
participant KV as kv::delete_all
participant Model as UserKV Model
participant DB as PostgreSQL
Client->>API: DELETE /protected/kv
Note over API: decrypt_request middleware
API->>API: Extract user from Extension
API->>AppState: delete_all(user.uuid)
AppState->>KV: delete_all(pool, user_id)
KV->>KV: Get DB connection from pool
KV->>Model: delete_all_for_user(conn, user_id)
Model->>DB: DELETE FROM user_kv WHERE user_id = ?
DB-->>Model: Success
Model-->>KV: Ok(())
KV-->>AppState: Ok(())
AppState-->>API: Ok(())
API->>API: encrypt_response with success message
API-->>Client: JSON response with encrypted confirmation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, no comments
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.