+2
-2
src/api/mod.ts
+2
-2
src/api/mod.ts
···
313
"/xrpc/social.grain.graph.createFollow",
314
["POST"],
315
async (req, _params, ctx) => {
316
-
const { did } = ctx.requireAuth();
317
const { subject } = await parseCreateFollowInputs(req);
318
if (!subject) {
319
throw new XRPCError("InvalidRequest", "Missing subject input");
320
}
321
try {
322
-
const followUri = await createFollow(did, subject, ctx);
323
return ctx.json({ followUri } satisfies CreateFollowOutputSchema);
324
} catch (error) {
325
console.error("Error creating follow:", error);
···
313
"/xrpc/social.grain.graph.createFollow",
314
["POST"],
315
async (req, _params, ctx) => {
316
+
ctx.requireAuth();
317
const { subject } = await parseCreateFollowInputs(req);
318
if (!subject) {
319
throw new XRPCError("InvalidRequest", "Missing subject input");
320
}
321
try {
322
+
const followUri = await createFollow(subject, ctx);
323
return ctx.json({ followUri } satisfies CreateFollowOutputSchema);
324
} catch (error) {
325
console.error("Error creating follow:", error);
-2
src/lib/graph.ts
-2
src/lib/graph.ts
···
124
}
125
126
export async function createFollow(
127
-
followerDid: string,
128
followeeDid: string,
129
ctx: BffContext,
130
): Promise<string> {
131
const followUri = await ctx.createRecord<GrainFollow>(
132
"social.grain.graph.follow",
133
{
134
-
did: followerDid,
135
subject: followeeDid,
136
createdAt: new Date().toISOString(),
137
},