From ee0e7eef5de86b8ad891912813488610b3231b20 Mon Sep 17 00:00:00 2001 From: Julien Herr Date: Mon, 25 May 2026 17:18:19 +0200 Subject: [PATCH] feat(infra): project hasNativeFeed into feeds:list Co-Authored-By: Claude Sonnet 4.6 --- src/infrastructure/feed-mapper.test.ts | 12 ++++++++++++ src/infrastructure/feed-mapper.ts | 2 ++ src/infrastructure/feed-repository.ts | 21 ++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/feed-mapper.test.ts b/src/infrastructure/feed-mapper.test.ts index e05906b..97be55f 100644 --- a/src/infrastructure/feed-mapper.test.ts +++ b/src/infrastructure/feed-mapper.test.ts @@ -44,6 +44,18 @@ describe("feed-mapper", () => { mailbox_id: "a.b.42", expires_at: 3000, pendingConfirmation: false, + hasNativeFeed: false, }); }); + + it("projects hasNativeFeed when passed", () => { + const item = toListItemDTO( + FeedId.unchecked("a.b.42"), + fromConfigDTO(fullConfig), + true, + true, + ); + expect(item.pendingConfirmation).toBe(true); + expect(item.hasNativeFeed).toBe(true); + }); }); diff --git a/src/infrastructure/feed-mapper.ts b/src/infrastructure/feed-mapper.ts index 69dd1d7..76ca451 100644 --- a/src/infrastructure/feed-mapper.ts +++ b/src/infrastructure/feed-mapper.ts @@ -49,6 +49,7 @@ export function toListItemDTO( id: FeedId, state: FeedState, pendingConfirmation = false, + hasNativeFeed = false, ): FeedListItem { return { id: id.value, @@ -57,5 +58,6 @@ export function toListItemDTO( mailbox_id: state.mailboxId, expires_at: state.expiresAt, pendingConfirmation, + hasNativeFeed, }; } diff --git a/src/infrastructure/feed-repository.ts b/src/infrastructure/feed-repository.ts index 90cd6b3..237e112 100644 --- a/src/infrastructure/feed-repository.ts +++ b/src/infrastructure/feed-repository.ts @@ -88,7 +88,12 @@ export class FeedRepository { this.putConfig(feed.id, toConfigDTO(feed.state())), this.putMetadata(feed.id, feed.toMetadataSnapshot()), this.upsertListEntry( - toListItemDTO(feed.id, feed.state(), feed.pendingConfirmation), + toListItemDTO( + feed.id, + feed.state(), + feed.pendingConfirmation, + feed.hasNativeFeed(), + ), ), this.putInboundIndex(feed.mailboxId, feed.id), ]); @@ -104,7 +109,12 @@ export class FeedRepository { await Promise.all([ this.putMetadata(feed.id, feed.toMetadataSnapshot()), this.upsertListEntry( - toListItemDTO(feed.id, feed.state(), feed.pendingConfirmation), + toListItemDTO( + feed.id, + feed.state(), + feed.pendingConfirmation, + feed.hasNativeFeed(), + ), ), ]); } @@ -118,7 +128,12 @@ export class FeedRepository { await Promise.all([ this.putConfig(feed.id, toConfigDTO(feed.state())), this.upsertListEntry( - toListItemDTO(feed.id, feed.state(), feed.pendingConfirmation), + toListItemDTO( + feed.id, + feed.state(), + feed.pendingConfirmation, + feed.hasNativeFeed(), + ), ), this.putInboundIndex(feed.mailboxId, feed.id), ]);