mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-21 06:13: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:
@@ -16,6 +16,15 @@ export class FeedId {
|
||||
return match ? new FeedId(match[1]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap an id we already trust — a value we minted ourselves and round-tripped
|
||||
* through our own links or KV keys (route params, the feed list, email keys).
|
||||
* No validation: a wrong id simply misses in KV and 404s, exactly as before.
|
||||
*/
|
||||
static fromTrusted(value: string): FeedId {
|
||||
return new FeedId(value);
|
||||
}
|
||||
|
||||
static generate(): FeedId {
|
||||
const noun1 = nouns[Math.floor(Math.random() * nouns.length)];
|
||||
const noun2 = nouns[Math.floor(Math.random() * nouns.length)];
|
||||
|
||||
Reference in New Issue
Block a user