This repository has no description
0

Configure Feed

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

semble / src / modules / atproto / infrastructure / mappers / CollectionLinkRemovalMapper.ts
1.2 kB 32 lines
1import { PublishedRecordIdProps } from 'src/modules/cards/domain/value-objects/PublishedRecordId'; 2import { Record } from '../lexicon/types/network/cosmik/collectionLinkRemoval'; 3import { EnvironmentConfigService } from 'src/shared/infrastructure/config/EnvironmentConfigService'; 4 5type CollectionLinkRemovalRecordDTO = Record; 6 7export class CollectionLinkRemovalMapper { 8 private static configService = new EnvironmentConfigService(); 9 static collectionLinkRemovalType = 10 CollectionLinkRemovalMapper.configService.getAtProtoCollections() 11 .collectionLinkRemoval; 12 13 static toCreateRecordDTO( 14 collectionPublishedRecordId: PublishedRecordIdProps, 15 removedLinkPublishedRecordId: PublishedRecordIdProps, 16 ): CollectionLinkRemovalRecordDTO { 17 const record: CollectionLinkRemovalRecordDTO = { 18 $type: this.collectionLinkRemovalType as any, 19 collection: { 20 uri: collectionPublishedRecordId.uri, 21 cid: collectionPublishedRecordId.cid, 22 }, 23 removedLink: { 24 uri: removedLinkPublishedRecordId.uri, 25 cid: removedLinkPublishedRecordId.cid, 26 }, 27 removedAt: new Date().toISOString(), 28 }; 29 30 return record; 31 } 32}