Insta-style Online-Status mit Following-Filter + User-opt-out: - Profile.lastSeenAt + Profile.presenceVisible (default true) - GET /api/presence/last-seen?userIds=... batch, server-side filter durch Follow-Relation + presenceVisible - GET /api/me/following → User-IDs für client-side Channel-Filter (Supabase Realtime Presence hat keine server-side Filter) - POST /api/me/presence-visibility Toggle - POST /api/me/last-seen Heartbeat (Phase-1-Fallback bis Edge-Function) - /api/auth/me extended um presenceVisible für Settings-Initial-State DB-Layer nutzt raw SQL bis Migration auf staging gelaufen ist (Prisma-Client refresh erst nach CI generate). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
20 lines
582 B
TypeScript
20 lines
582 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";
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const user = await requireUser(event);
|
|
const userIds = await getFollowingIds(user.id);
|
|
return { userIds };
|
|
});
|