import { revokeAllUserSessions } from '@/modules/admin/services/admin-users.service';
import type { AppContext } from '@/types/hono';

type RevokeSessionsParams = { id: string };

export async function revokeAllSessionsHandler(c: AppContext) {
  const { id } = c.req.valid('param' as never) as RevokeSessionsParams;

  const count = await revokeAllUserSessions(id);

  return c.json({ message: `${count} sesiones cerradas correctamente.` });
}
