import { db, userFollows, and, eq } from "@epicure/db"; /** True if `followerId` follows `followingId`. Used to gate "followers only" * visibility content — the same leftJoin+isNotNull idiom used elsewhere * (e.g. the for-you feed's private-author check) collapsed into a single * existence check for the single-recipe case. */ export async function isFollowing(followerId: string, followingId: string): Promise { if (followerId === followingId) return true; const [row] = await db .select({ followerId: userFollows.followerId }) .from(userFollows) .where(and(eq(userFollows.followerId, followerId), eq(userFollows.followingId, followingId))) .limit(1); return !!row; }