Conversation
…d in health controller
|
Caution Review failedFailed to post review comments. WalkthroughAdds a HealthModule with liveness/readiness endpoints, optional IP allowlist, and docs/env for probes. Introduces offer auto-expiration (cron, endpoints, entity/migration), notification enhancements, product-linking in offers, UUID migration and walletAddress-first flows, store system (entities, services, controllers), expanded user fields/validation, Redis/cookie support, and extensive tests/migrations. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Probe as K8s/LB Probe
participant API as NestJS API
participant Guard as HealthAllowlistGuard
participant HC as HealthCheckService
participant DB as DB Indicator
participant Redis as Redis Client
participant Mem as Memory Indicator
participant Disk as Disk Indicator
Probe->>API: GET /health/live
API->>Guard: canActivate(ip)
alt Allowed
API-->>Probe: 200 {status:"up"}
else Forbidden
API-->>Probe: 403
end
Probe->>API: GET /health/ready
API->>Guard: canActivate(ip)
alt Allowed
API->>HC: check([ ... ])
HC->>DB: pingCheck (300ms timeout)
opt REDIS_URL set
HC->>Redis: connect + ping
Redis-->>HC: pong
end
opt Heap threshold
HC->>Mem: checkHeap(threshold)
end
opt Disk threshold
HC->>Disk: checkStorage(used%)
end
HC-->>API: aggregated result
API-->>Probe: 200/5xx + details
else Forbidden
API-->>Probe: 403
end
sequenceDiagram
autonumber
actor Cron as Cron(30m)
participant OfferSvc as OfferService
participant Repo as OfferRepository
participant Notif as NotificationService
actor Admin as Admin
participant Ctl as OffersController
Cron->>OfferSvc: expireOffers()
OfferSvc->>Repo: find(status=PENDING, expiresAt < now)
alt Any expired
OfferSvc->>Repo: update(set status=REJECTED)
loop each expired
OfferSvc->>Notif: createAndSendNotificationToUser(type=offer_rejected, entityId=offerId, payload={...})
end
OfferSvc-->>Cron: count
else None
OfferSvc-->>Cron: 0
end
Admin->>Ctl: POST /offers/expire-manual
Ctl->>OfferSvc: expireOffers()
OfferSvc-->>Ctl: count
Ctl-->>Admin: {expired: count, timestamp}
Admin->>Ctl: GET /offers/expiring-soon?hours=H
Ctl->>OfferSvc: getOffersExpiringSoon(H)
OfferSvc-->>Ctl: offers[]
Ctl-->>Admin: {offers, count}
Admin->>Ctl: GET /offers/:id/expired
Ctl->>OfferSvc: isOfferExpired(id)
OfferSvc-->>Ctl: true/false
Ctl-->>Admin: {isExpired}
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
🚀 StarShop Pull Request
Mark with an
xall the checkboxes that apply (like[x])📌 Type of Change
📝 Changes description
/health/liveand/health/readyendpoints./healthroutes in production..env.examplewith new health config variables.README.mdwith usage and Kubernetes probe examples.📸 Evidence (A photo is required as evidence)
⏰ Time spent breakdown
🌌 Comments
This PR introduces robust observability endpoints for StarShop, ensuring better compatibility with Kubernetes, Docker health checks, and external monitoring tools.
Thank you for contributing to StarShop, we are glad that you have chosen us as your project of choice and we hope that you continue to contribute to this great project, so that together we can make our mark at the top!
Summary by CodeRabbit
New Features
Refactor
Documentation
Chores
Tests