mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
refactor(domain): make FeedId circulate through the domain and repository
FeedId is now the type of Feed.id and of every single-feed method on FeedRepository; callers wrap raw strings via FeedId.fromTrusted at the repository boundary. String-medium operations (URLs, logs, JSON, list registry, email keys) stay string. Drop the redundant generateFeedId wrapper in favour of FeedId.generate. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Env, FeedConfig, FeedMetadata, EmailMetadata } from "../types";
|
||||
import { FeedId } from "./value-objects/feed-id";
|
||||
import {
|
||||
resolveExpiresAt,
|
||||
isExpired,
|
||||
@@ -46,13 +47,13 @@ export interface IngestOptions {
|
||||
*/
|
||||
export class Feed {
|
||||
private constructor(
|
||||
readonly id: string,
|
||||
readonly id: FeedId,
|
||||
private _config: FeedConfig,
|
||||
private _metadata: FeedMetadata,
|
||||
) {}
|
||||
|
||||
/** Mint a brand-new feed with an empty email index. */
|
||||
static create(id: string, input: CreateFeedInput, env: Env): Feed {
|
||||
static create(id: FeedId, input: CreateFeedInput, env: Env): Feed {
|
||||
const now = Date.now();
|
||||
const expiresAt = resolveExpiresAt(env, input.lifetimeHours);
|
||||
const config: FeedConfig = {
|
||||
@@ -70,7 +71,7 @@ export class Feed {
|
||||
|
||||
/** Rebuild an aggregate from persisted state. */
|
||||
static reconstitute(
|
||||
id: string,
|
||||
id: FeedId,
|
||||
config: FeedConfig,
|
||||
metadata: FeedMetadata,
|
||||
): Feed {
|
||||
|
||||
Reference in New Issue
Block a user