feat: in-app delete for journal trades + account purge - #4
Merged
Conversation
Replaces the need for raw production SQL to clean up data. All paths are ownership-scoped (a user can only ever touch their own rows). Journal: - DELETE /journal/trades/:accountId — filter-aware bulk delete (from/to date, symbol, direction, session); no filters = clear the account's journal. Returns the deleted count. - DELETE /journal/trades/:accountId/:dealTicket — single trade. - JournalPage: a Delete action opens a modal with "Before a date" (e.g. everything before 2026-06-01) and "Clear entire journal" (typed confirm) modes, plus a per-row trash button. Account hard-delete: - DELETE /accounts/:id/purge — atomic batch that removes the account and every row referencing it (journal_trades, symbol_mappings, follower_config, prop_rules, daily_stats, blocked_trades, firm_templates, signals, executions, provider_profiles, marketplace_subscriptions), then the account. Distinct from the existing soft deactivate. - Delete Account modal gains a gated "permanently erase" path (type the account name to confirm). Stores gain deleteTrades/deleteTrade and purgeAccount. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds proper in-app delete controls so cleaning up data (e.g. old synced trades after re-syncing an account) never requires raw production SQL again. Every path is ownership-scoped — a user can only ever delete their own rows.
Journal deletes
DELETE /journal/trades/:accountId— filter-aware bulk delete (samefrom/to/symbol/direction/session_tagfilters as the GET list); no filters = clear the account's whole journal. Returns the deleted count.DELETE /journal/trades/:accountId/:dealTicket— delete one trade.2026-06-01to remove everything before June 2026; UTC) and Clear entire journal (type the account name to confirm) — plus a per-row trash button.Account hard-delete (purge)
DELETE /accounts/:id/purge— atomicdb.batch()that removes the account and every row referencing it:journal_trades,symbol_mappings,follower_config,prop_rules,daily_stats,blocked_trades,firm_templates,signals,executions,provider_profiles,marketplace_subscriptions, then the account itself. Distinct from the existing soft deactivate (DELETE /accounts/:id).Stores gain
deleteTrades/deleteTrade(journal) andpurgeAccount(accounts).Safety
verifyAccountOwnership/WHERE user_id = ?) — multi-tenant safe.Verification
0001,0004,0006,0008,0012).tsc/vite buildcan't run in the dev environment (nonode_modules) — CI Typecheck gates the deploy. I have not exercised the delete flows against a live DB.🤖 Generated with Claude Code