mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
refactor(domain): consolidate Feed aggregate invariants in domain/feed.ts
Gather the feed's scattered business rules — expiry, sender allow/block policy, and the email byte-size budget — into one framework-agnostic module. Expiry was duplicated across feed-service, email-processor and the rss/atom/entries routes; the sender policy and trim loop lived inline in email-processor. Each now calls a single function (isExpired, applySenderPolicy, trimToByteBudget, resolveExpiresAt). Drops the now-unused MAX_METADATA_EMAILS constant. Behaviour-preserving; adds feed.test.ts covering every invariant. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -16,9 +16,6 @@ export const ADMIN_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; // 1 week
|
||||
/** Maximum number of feed items exposed in RSS/Atom responses. */
|
||||
export const MAX_FEED_ITEMS = 20;
|
||||
|
||||
/** Maximum number of email entries kept in feed metadata. */
|
||||
export const MAX_METADATA_EMAILS = 50;
|
||||
|
||||
/** Default WebSub lease duration (seconds). */
|
||||
export const DEFAULT_LEASE_SECONDS = 86400; // 24 hours
|
||||
|
||||
|
||||
Reference in New Issue
Block a user