refactor: migrate pool.query() calls in push_subscriptions to table methods#275
Merged
hoiekim merged 1 commit intohoiekim:mainfrom Mar 25, 2026
Merged
Conversation
Contributor
Author
|
Self-review: pool.query() migration for push_subscriptions. Pattern consistency:
getByUserIds review:
deleteOlderThan review:
getSubscriptions cleanup:
TypeScript clean. No behavior changes. |
Contributor
Author
Self-ReviewDiscussion thread status:
Checked:
E2E Testing:
Issues found:
Confidence: High |
…ethods Per DEVELOPMENT.md convention, DB operations in repository files should go through Table class methods rather than calling pool.query() directly. push_subscriptions.ts (2 pool.query calls removed): - Convert pushSubscriptionsTable from createTable() to a PushSubscriptionsTable class - Add getByUserIds() method for SELECT WHERE user_id IN (...) queries - Add deleteOlderThan() method for DELETE WHERE updated < cutoff - cleanSubscriptions() now delegates to pushSubscriptionsTable.deleteOlderThan() - getSubscriptions() now delegates to pushSubscriptionsTable.getByUserIds() - Removed direct pool import from repository file No behavior changes; TypeScript compiles cleanly. Part of hoiekim#244
fc257c0 to
390cec8
Compare
hoiekim
approved these changes
Mar 25, 2026
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
Completes the pool.query() migration started in PR #248 (sessions + spam_allowlists). This PR covers the remaining repository file with direct pool.query() calls.
push_subscriptions.ts (2 pool.query calls removed):
pushSubscriptionsTablefromcreateTable()to a namedPushSubscriptionsTableclassgetByUserIds(userIds: string[])— encapsulatesSELECT * WHERE user_id IN (...)deleteOlderThan(cutoff: string)— encapsulatesDELETE WHERE updated < $1cleanSubscriptions()now delegates topushSubscriptionsTable.deleteOlderThan()getSubscriptions()now delegates topushSubscriptionsTable.getByUserIds()poolimport removed from the repository fileMotivation
Per DEVELOPMENT.md Table Class Methods convention: all DB operations in repository files should go through table class methods. Direct
pool.query()calls in repositories are migration debt.No Behavior Changes
Same SQL queries, same logic. TypeScript compiles cleanly.
Closes #244 (together with PR #248)