This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

refactor: update publishCardToLibrary to use parentCardPublishedRecordId

Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>

+14 -11
+1 -1
src/modules/atproto/infrastructure/__tests__/ATProtoCardPublisher.integration.test.ts
··· 318 318 const notePublishResult = await publisher.publishCardToLibrary( 319 319 noteCard, 320 320 curatorId, 321 - parentUrlCard, 321 + parentUrlCard.publishedRecordId, 322 322 ); 323 323 expect(notePublishResult.isOk()).toBe(true); 324 324
+4 -3
src/modules/atproto/infrastructure/mappers/CardMapper.ts
··· 11 11 import { UrlMetadata as UrlMetadataVO } from 'src/modules/cards/domain/value-objects/UrlMetadata'; 12 12 import { CuratorId } from 'src/modules/cards/domain/value-objects/CuratorId'; 13 13 import { EnvironmentConfigService } from 'src/shared/infrastructure/config/EnvironmentConfigService'; 14 + import { PublishedRecordId } from 'src/modules/cards/domain/value-objects/PublishedRecordId'; 14 15 15 16 type CardRecordDTO = Record; 16 17 ··· 20 21 static toCreateRecordDTO( 21 22 card: Card, 22 23 curatorId: CuratorId, 23 - parentCard?: Card, 24 + parentCardPublishedRecordId?: PublishedRecordId, 24 25 ): CardRecordDTO { 25 26 const record: CardRecordDTO = { 26 27 $type: this.cardCollection as any, ··· 42 43 }; 43 44 } 44 45 45 - if (card.parentCardId && parentCard && parentCard.publishedRecordId) { 46 - const strongRef = new StrongRef(parentCard.publishedRecordId.getValue()); 46 + if (card.parentCardId && parentCardPublishedRecordId) { 47 + const strongRef = new StrongRef(parentCardPublishedRecordId.getValue()); 47 48 record.parentCard = { 48 49 uri: strongRef.getValue().uri, 49 50 cid: strongRef.getValue().cid,
+2 -2
src/modules/atproto/infrastructure/publishers/ATProtoCardPublisher.ts
··· 20 20 async publishCardToLibrary( 21 21 card: Card, 22 22 curatorId: CuratorId, 23 - parentCard?: Card, 23 + parentCardPublishedRecordId?: PublishedRecordId, 24 24 ): Promise<Result<PublishedRecordId, UseCaseError>> { 25 25 try { 26 - let record = CardMapper.toCreateRecordDTO(card, curatorId, parentCard); 26 + let record = CardMapper.toCreateRecordDTO(card, curatorId, parentCardPublishedRecordId); 27 27 record.$type = this.cardCollection as any; 28 28 29 29 const curatorDidResult = DID.create(curatorId.value);
+1 -1
src/modules/cards/application/ports/ICardPublisher.ts
··· 8 8 publishCardToLibrary( 9 9 card: Card, 10 10 curatorId: CuratorId, 11 - parentCard?: Card, 11 + parentCardPublishedRecordId?: PublishedRecordId, 12 12 ): Promise<Result<PublishedRecordId, UseCaseError>>; 13 13 14 14 unpublishCardFromLibrary(
+5 -3
src/modules/cards/domain/services/CardLibraryService.ts
··· 7 7 import { AppError } from '../../../../shared/core/AppError'; 8 8 import { DomainService } from '../../../../shared/domain/DomainService'; 9 9 import { CardCollectionService } from './CardCollectionService'; 10 + import { PublishedRecordId } from '../value-objects/PublishedRecordId'; 10 11 11 12 export class CardLibraryValidationError extends Error { 12 13 constructor(message: string) { ··· 45 46 ), 46 47 ); 47 48 } 48 - let parentCard: Card | undefined = undefined; 49 + let parentCardPublishedRecordId: PublishedRecordId | undefined = 50 + undefined; 49 51 50 52 if (card.parentCardId) { 51 53 // Ensure parent card is in the curator's library ··· 64 66 if (!parentCardValue) { 65 67 return err(new CardLibraryValidationError(`Parent card not found`)); 66 68 } 67 - parentCard = parentCardValue; 69 + parentCardPublishedRecordId = parentCardValue.publishedRecordId; 68 70 } 69 71 70 72 // Publish card to library 71 73 const publishResult = await this.cardPublisher.publishCardToLibrary( 72 74 card, 73 75 curatorId, 74 - parentCard, 76 + parentCardPublishedRecordId, 75 77 ); 76 78 if (publishResult.isErr()) { 77 79 return err(
+1 -1
src/modules/cards/tests/utils/FakeCardPublisher.ts
··· 19 19 async publishCardToLibrary( 20 20 card: Card, 21 21 curatorId: CuratorId, 22 - parentCard?: Card, 22 + parentCardPublishedRecordId?: PublishedRecordId, 23 23 ): Promise<Result<PublishedRecordId, UseCaseError>> { 24 24 if (this.shouldFail) { 25 25 return err(