chahinebrini 19b569927a fix(presence): missing imports in 3 endpoints
Same pattern as touchLastSeen: getLastSeenBatch, setPresenceVisible,
getFollowingIds wurden im db/profile.ts implementiert aber nicht in den
Endpoints importiert. Alle 3 warfen 500 ReferenceError → grüner Dot
zeigte sich nie + Toggle silently failed.

Nitro's auto-import covered nur defineEventHandler/getQuery etc., NICHT
unsere eigenen db-layer helper.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 07:16:18 +02:00

21 lines
634 B
TypeScript

/**
* GET /api/me/following
*
* Returns the IDs of all users the authenticated user follows.
* Used client-side to filter the Supabase Realtime Presence channel —
* Realtime has no native server-side filter, so the frontend needs the list.
*
* No pagination — follows rarely exceed 1 k for a single user.
*
* Response:
* { userIds: string[] }
*/
import { requireUser } from "../../utils/auth";
import { getFollowingIds } from "../../db/profile";
export default defineEventHandler(async (event) => {
const user = await requireUser(event);
const userIds = await getFollowingIds(user.id);
return { userIds };
});