import { prisma } from '../config/database.js';

export async function getBlockedUserIds(userId: string): Promise<string[]> {
  const blocks = await prisma.blockedUser.findMany({
    where: {
      OR: [{ blockerId: userId }, { blockedId: userId }],
    },
    select: { blockerId: true, blockedId: true },
  });

  const ids = new Set<string>();
  for (const block of blocks) {
    if (block.blockerId === userId) ids.add(block.blockedId);
    else ids.add(block.blockerId);
  }
  return Array.from(ids);
}
