Files
2026-07-11 21:40:18 +03:00

19 lines
584 B
TypeScript

import { getSessionUserId } from "@/lib/auth/session";
import { findUserById, findUsersByIds } from "@/lib/user/repository";
export async function getCurrentUser() {
const userId = await getSessionUserId();
if (!userId) return null;
return findUserById(userId);
}
export async function getUser(id: string | null) {
if (!id) return null;
return findUserById(id);
}
export async function getUsers(...ids: (string | null | undefined)[]) {
const filtered = ids.filter((id): id is string => !!id);
if (filtered.length === 0) return [];
return findUsersByIds(filtered);
}