This repository has no description
0

Configure Feed

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

include following status in bluesky profile service

+29 -3
+25 -2
src/modules/atproto/infrastructure/services/BlueskyProfileService.ts
··· 6 6 import { IAgentService } from '../../application/IAgentService'; 7 7 import { DID } from '../../domain/DID'; 8 8 import { AuthenticationError } from 'src/shared/core/AuthenticationError'; 9 + import { IFollowsRepository } from 'src/modules/user/domain/repositories/IFollowsRepository'; 10 + import { FollowTargetType } from 'src/modules/user/domain/value-objects/FollowTargetType'; 9 11 10 12 export class BlueskyProfileService implements IProfileService { 11 - constructor(private readonly agentService: IAgentService) {} 13 + constructor( 14 + private readonly agentService: IAgentService, 15 + private readonly followsRepository: IFollowsRepository, 16 + ) {} 12 17 13 18 async getProfile( 14 19 userId: string, ··· 76 81 bio: profile.description, 77 82 }; 78 83 79 - return ok(userProfile); 84 + // Add follow status if callerId is provided 85 + let isFollowing: boolean | undefined = undefined; 86 + if (callerDid && callerDid !== userId) { 87 + const followResult = 88 + await this.followsRepository.findByFollowerAndTarget( 89 + callerDid, 90 + userId, 91 + FollowTargetType.USER, 92 + ); 93 + 94 + if (followResult.isOk()) { 95 + isFollowing = followResult.value !== null; 96 + } 97 + } 98 + 99 + return ok({ 100 + ...userProfile, 101 + isFollowing, 102 + }); 80 103 } catch (error) { 81 104 return err( 82 105 new Error(
+4 -1
src/shared/infrastructure/http/factories/ServiceFactory.ts
··· 315 315 ); 316 316 317 317 // Profile Service with Redis caching 318 - const baseProfileService = new BlueskyProfileService(atProtoAgentService); 318 + const baseProfileService = new BlueskyProfileService( 319 + atProtoAgentService, 320 + repositories.followsRepository, 321 + ); 319 322 320 323 let profileService: IProfileService; 321 324