Skip to content

refactor(storage): extract WebhookRepository across all three storage adapters#125

Merged
KIvanow merged 1 commit into
BetterDB-inc:masterfrom
amitkojha05:refactor/webhook-repository
May 1, 2026
Merged

refactor(storage): extract WebhookRepository across all three storage adapters#125
KIvanow merged 1 commit into
BetterDB-inc:masterfrom
amitkojha05:refactor/webhook-repository

Conversation

@amitkojha05
Copy link
Copy Markdown
Contributor

Summary

Implements the first step of the TODO on postgres.adapter.ts line 49:
Extracts all webhook and delivery methods from PostgresAdapter, SqliteAdapter, and MemoryAdapter into dedicated repository classes under apps/api/src/storage/adapters/repositories/. Each adapter becomes a thin facade that delegates to its repository. Follows the same pattern established in PR #13 (MultiConnectionPoller base class extraction).

Changes

  • repositories/webhook.postgres.repository.ts — new, owns all Postgres webhook/delivery SQL
  • repositories/webhook.sqlite.repository.ts — new, owns all SQLite webhook/delivery SQL
  • repositories/webhook.memory.repository.ts — new, owns all in-memory webhook/delivery logic
  • postgres.adapter.ts — delegates to WebhookPostgresRepository, retains if (!this.pool) guards
  • sqlite.adapter.ts — delegates to WebhookSqliteRepository, retains if (!this.db) guards
  • memory.adapter.ts — delegates to WebhookMemoryRepository, Maps moved into repository

Zero behavior changes. All three adapters implement the same StoragePort interface contract as before.

The updated TODO now lists the remaining domains to extract:

Checklist

  • Unit / integration tests added — existing webhook-storage test suite covers all three adapters via the StoragePort interface; zero test changes required
  • Docs added / updated — no user-facing docs affected by this refactor
  • Roborev review passed — (internal)
  • Competitive analysis done / discussed — (internal)
  • Blog post about it discussed — (internal)

Addresses the TODO on postgres.adapter.ts L49. Extracts all webhook and delivery methods from PostgresAdapter, SqliteAdapter, and MemoryAdapter into dedicated WebhookRepository classes under apps/api/src/storage/adapters/repositories/.

Each adapter becomes a thin facade that delegates to its repository. Zero behavior changes - existing webhook-storage test suite (25 tests) passes unchanged.

Establishes the pattern for extracting the remaining domains (ACL, anomaly, slowlog, commandlog, latency, memory, hotkeys, etc.) in follow-up PRs.

Made-with: Cursor
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@amitkojha05
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 24, 2026
@amitkojha05
Copy link
Copy Markdown
Contributor Author

@KIvanow @jamby77 Please review this PR ,would love to hear your feedback.

@KIvanow
Copy link
Copy Markdown
Member

KIvanow commented Apr 30, 2026

Looks good overall!

@KIvanow KIvanow merged commit dd8aa2a into BetterDB-inc:master May 1, 2026
2 of 3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants