Postgres connection pooling, automated startup migrations, cached gig search, IPFS API integration tests - #197
Merged
meshackyaro merged 1 commit intoAug 27, 2026
Conversation
…cached gig search, and IPFS API integration tests Configure PostgreSQL connection (trustflow-protocol#27) - New DatabaseModule/DatabaseService (src/common/database) providing a pg Pool configured via DATABASE_URL or discrete DB_HOST/DB_PORT/DB_NAME/ DB_USER/DB_PASSWORD, with pool-size/timeout/SSL env vars. Mirrors RedisModule: resolves to null when unconfigured so the app still boots without a local Postgres. - Wired into AppModule and into GET /health, which now reports a `database` check (true/not-applicable when unconfigured, real ping result once DATABASE_URL or DB_HOST/DB_NAME is set). Add automated DB migrations (trustflow-protocol#47) - New MigrationStartupService runs every migration registered with MigrationRegistryService automatically via OnApplicationBootstrap, instead of requiring a manual POST /migrations/:name/run per migration. Gated by RUN_MIGRATIONS_ON_STARTUP (defaults to enabled outside NODE_ENV=test); a failure in one migration is logged and doesn't block the others or app startup. Implement caching for gig search (trustflow-protocol#40) - New GET /gigs endpoint: paginated search over gig solicitations (status/page/limit query params, defaulting to open gigs sorted newest first). - Results are cached in Redis for GIG_SEARCH_CACHE_TTL_SECONDS (default 30s) to reduce load on repeated queries; every gig mutation (create/accept/cancel/update/remove/expire) invalidates the cache via a tracked key set, so a change is never masked by a stale cached page. Draft API integration tests for IPFS pinning (trustflow-protocol#41) - New Supertest-driven API integration suite (ipfs-pinning.e2e-spec.ts) that boots a real Nest application and exercises the full HTTP surface of the pinning API — auth, pin/list/ get/verify/unpin, provider failover, full-failure 503, and automatic re-pin on a silently dropped provider — against fake providers injected via the PIN_PROVIDERS token, so no external network calls are made. Co-Authored-By: KRIS <307999362+kris-nana@users.noreply.github.com>
|
@kris-nana Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
10 tasks
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
Closes #27, Closes #40, Closes #41, Closes #47
DatabaseModule/DatabaseService(backend/src/common/database) providing apgconnection pool configured viaDATABASE_URLor discreteDB_HOST/DB_PORT/DB_NAME/DB_USER/DB_PASSWORDenv vars, with pool-size/timeout/SSL tuning. Mirrors the existingRedisModulepattern: resolves tonullwhen unconfigured so the app still boots without a local Postgres. Wired intoAppModuleand intoGET /health, which now reports adatabasecheck.MigrationStartupService, which runs every migration registered withMigrationRegistryServiceautomatically on boot viaOnApplicationBootstrap, instead of requiring a manualPOST /migrations/:name/runper migration. Gated byRUN_MIGRATIONS_ON_STARTUP(defaults to enabled outsideNODE_ENV=test); one migration failing doesn't block the others or app startup.GET /gigs, a paginated search endpoint over gig solicitations (status/page/limit, defaulting to open gigs sorted newest first). Results are cached in Redis forGIG_SEARCH_CACHE_TTL_SECONDS(default 30s); every gig mutation invalidates the cache via a tracked key set so a stale page is never served.ipfs-pinning.e2e-spec.ts) that boots a real Nest application and exercises the full HTTP surface of the pinning API — auth, pin/list/get/verify/unpin, provider failover, full-failure 503, and automatic re-pin recovery — against fake providers injected via thePIN_PROVIDERSDI token, so no external network calls are made.All new env vars are documented in
.env.exampleandbackend/SETUP_INSTRUCTIONS.md.Test plan
npm run lint:check— clean (only pre-existing warnings in untouched files)npx tsc --noEmit— cleannpm run build— cleannpx jest— all tests pass except a pre-existing, unrelated flaky test (common/idempotency/idempotency.integration.spec.ts, a concurrency race test not touched by this PR)