summaryrefslogtreecommitdiffstats
path: root/internal/db/posts_test.go
Commit message (Collapse)AuthorAgeFilesLines
* fix: make slug rename and content update atomic via RenameAndUpsertPostivar11 days1-0/+46
| | | | | | | | Previously RenamePost + UpsertPost were two separate DB calls; a failure between them left the post at the new slug with stale content. The new RenameAndUpsertPost method does both in a single transaction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add RenamePost with transactional rename and redirect creationivar11 days1-0/+70
| | | | | | | | | | | | | | | Implement RenamePost method that atomically: 1. Fetches the post record by old slug 2. Inserts a new record with the new slug 3. Deletes the old slug post 4. Collapses redirect chains (updates any redirects pointing to oldSlug to point to newSlug) 5. Creates a redirect from oldSlug to newSlug All operations are transactional (all-or-nothing). Includes two comprehensive tests: - TestRenamePost: basic rename with redirect creation and old slug deletion - TestRenamePost_CollapsesChain: verifies redirect chains are collapsed correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add redirect DB methods (AddRedirect, GetRedirect, CollapseRedirects)ivar11 days1-0/+80