import userCls from './user.cls.js';

export default async function userClsId(req) {
  const { id } = req.params || {};
  const res = await userCls(req);
  if (req.query?.sql || res?.error) {
    return res;
  }
  const { rows = [] } = res?.message || {};
  if (!rows?.length) {
    return { message: `cls not found: ${id}`, status: 404 };
  }
  return { message: rows?.[0], status: 200 };
}
