ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto
1import { AuthenticatedHandler } from "./core/types";
2import { SessionService } from "./services/SessionService";
3import { FollowService } from "./services/FollowService";
4import { successResponse, validateArrayInput, ValidationSchemas } from "./utils";
5import { withAuthErrorHandling } from "./core/middleware";
6
7const checkFollowStatusHandler: AuthenticatedHandler = async (context) => {
8 const body = JSON.parse(context.event.body || "{}");
9 const dids = validateArrayInput<string>(
10 context.event.body,
11 "dids",
12 ValidationSchemas.didsArray,
13 );
14 const followLexicon: string = body.followLexicon || "app.bsky.graph.follow";
15
16 const { agent } = await SessionService.getAgentForSession(
17 context.sessionId,
18 context.event,
19 );
20
21 const followStatus = await FollowService.checkFollowStatus(
22 agent,
23 context.did,
24 dids,
25 followLexicon,
26 );
27
28 return successResponse({ followStatus });
29};
30
31export const handler = withAuthErrorHandling(checkFollowStatusHandler);