feat(cntr): resolve BE-36, BE-37, BE-38, BE-39 — rating, webhook logger, token blacklist, opening hours#1068
Merged
yusuftomilola merged 1 commit intoJun 2, 2026
Conversation
|
@Tyler7x is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Tyler7x 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! 🚀 |
- BE-38 (DistinctCodes#977): Add TokenBlacklist class with Map-based in-memory store; blacklist/isBlacklisted/purgeExpired with optional now param for testability; isBlacklisted returns false for expired or unknown JTIs - BE-39 (DistinctCodes#978): Add validateOpeningHours with HH:MM regex validation, close>open enforcement when isClosed=false, duplicate dayOfWeek detection, and full multi-error accumulation (no fail-fast) - BE-37 (DistinctCodes#976): Add createWebhookEventLog with randomUUID id, ISO 8601 receivedAt, and payload sanitization that strips keys matching /(card|cvv|pan|account_number)/i without mutating the original object - BE-36 (DistinctCodes#975): Add WorkspaceRating service with validateRating (throws RangeError for score outside 1-5, Error for comment >500 chars) and computeAverageRating (1 decimal precision, returns 0 for empty array) Closes #975Closes #976Closes #977Closes DistinctCodes#978 Co-Authored-By: Demilade18-git <Demilade18-
9b6fc3d to
4190e47
Compare
yusuftomilola
approved these changes
Jun 2, 2026
Collaborator
yusuftomilola
left a comment
There was a problem hiding this comment.
Perfect implementation
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
Implements four self-contained utility/service files in
backend/cntr/, each with a paired unit test spec. All logic is pure TypeScript with no framework dependencies or external I/O.BE-38 — In-Memory JWT Token Blacklist (
#977)File:
backend/cntr/token-blacklist.util.tsTokenBlacklistclass backed byMap<string, Date>blacklist(jti, expiresAt)— stores the tokenisBlacklisted(jti)— returnsfalsefor unknown or expired JTIspurgeExpired(now?)— removes all entries whoseexpiresAt < now; accepts optionalnowparam for deterministic testsBE-39 — Workspace Opening Hours Validator (
#978)File:
backend/cntr/opening-hours.validator.tsOpeningHoursEntry,ValidationResultinterfaces andvalidateOpeningHours(hours)HH:MMformat with/^([01]\d|2[0-3]):[0-5]\d$/closeTime <= openTimewhenisClosed = falsedayOfWeekentriesBE-37 — Webhook Event Logger with Payload Sanitization (
#976)File:
backend/cntr/webhook-event-logger.tsWebhookEventLoginterface andcreateWebhookEventLog(event, payload, status, error?)idgenerated viacrypto.randomUUID()receivedAtis ISO 8601 string/(card|cvv|pan|account_number)/i(case-insensitive)BE-36 — Workspace Rating Service (
#975)File:
backend/cntr/workspace-rating.service.tsWorkspaceRatinginterface,validateRating, andcomputeAverageRatingvalidateRatingthrowsRangeErrorfor score outside 1–5 andErrorfor comment > 500 charscomputeAverageRating([])returns0Math.round(avg * 10) / 10Test plan
backend/cntr/token-blacklist.util.spec.ts— 6 tests covering unknown JTIs, valid tokens, expired tokens,purgeExpiredwith and withoutnowbackend/cntr/opening-hours.validator.spec.ts— 9 tests covering format errors, close≤open, duplicate days, multi-error accumulation, isClosed bypass, full weekbackend/cntr/webhook-event-logger.spec.ts— 7 tests covering UUID format, ISO date, sensitive key removal (all variants), no mutation, empty payloadbackend/cntr/workspace-rating.service.spec.ts— 13 tests covering all invalid scores, comment length boundary, all valid scores 1–5, average edge casesCloses #975
Closes #976
Closes #977
Closes #978