feat: filter whitespace normalization tests, creator detail include c…#239
Merged
Conversation
…onstants, feed cursor helper, slow query warning log
|
@Johnsmichael150 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! 🚀 |
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
Four focused improvements to the creator list and feed subsystems: test coverage for filter whitespace normalization, centralized include-field constants for creator detail reads, a validated cursor decode helper for the creator feed, and a configurable slow query warning log on the creator list path.
Changes
1. Filter whitespace normalization tests
src/modules/creators/creators.filter.test.tsAdded unit coverage for
parseCreatorFilterswhitespace handling:verified+searchcasesAlso aligned
parseCreatorFiltersto collapse internal whitespace (/\s+/g → ' '), matching the behavior ofnormalizeCreatorListSearchTerm.2. Centralized creator detail include-field constants
src/constants/creator-detail-include.constants.tssrc/modules/creator/creator-profile.service.tsDefined
CREATOR_DETAIL_DEFAULT_SELECTas a single source of truth for the Prisma select fields returned on every creator detail read. Applied it ingetCreatorProfileto replace the previously implicit full-row fetch. Response shape is backward compatible.3. Creator feed cursor decode helper
src/utils/creator-feed-cursor.utils.tsAdded
decodeCreatorFeedCursor(raw)which wraps the existingdecodeCursorutility and:{ ok: true, payload } | { ok: false, error }so callers avoid try/catchcreatedAtandidfieldsCursorChecksumErrormessages directly for consistent API error responses4. Slow creator list query warning log
src/config.tssrc/modules/creators/creators.utils.tsAdded
CREATOR_LIST_SLOW_QUERY_THRESHOLD_MSto the env config schema (default500ms). WhenfetchCreatorListexceeds the threshold, alogger.warnfires with sanitized metadata:Override the threshold via environment variable:
Files Changed
src/modules/creators/creators.filter.test.tssrc/modules/creators/creators.filter.tssrc/constants/creator-detail-include.constants.tsCREATOR_DETAIL_DEFAULT_SELECTsrc/modules/creator/creator-profile.service.tsCREATOR_DETAIL_DEFAULT_SELECTsrc/utils/creator-feed-cursor.utils.tsdecodeCreatorFeedCursorhelpersrc/config.tsCREATOR_LIST_SLOW_QUERY_THRESHOLD_MSconfig keysrc/modules/creators/creators.utils.tsTesting
Run existing test suite:
pnpm testRun filter tests directly:
node_modules/.bin/jest --testPathPatterns="creators.filter.test" --no-coverageBackward Compatibility
No breaking changes. All response shapes are preserved. The new config key has a safe default.
Linked Issues
Close #235
Close #236
Close #234
Close #233