修复授权分页并补齐追回到账诊断验证(09-17-company-loan-principal-repayment)

这个提交包含在:
2026-10-10 21:56:08 +08:00
父节点 db919dc6f6
当前提交 91fe31f0db
共修改 14 个文件,包含 623 行新增和 25 行删除
+5 -2
查看文件
@@ -239,8 +239,11 @@ async function companyLoansRoutes(fastify) {
});
fastify.get("/loan-lenders", auth, async (request, reply) => {
ensureLoanManager(fastify, request);
const query = parse(LIST.omit({ lenderId: true }), request.query ?? {});
const where = { archived_at: null };
const query = parse(LIST.omit({ lenderId: true }).extend({ eligible: z.enum(["related_authority"]).optional() }).strict(), request.query ?? {});
// The authorization dialog pages only lenders it can offer, so no page is
// empty after client-side filtering.
const where = { archived_at: null, ...(query.eligible === "related_authority"
? { identity_status: "verified", employee_id: { not: null }, NOT: { employee_id: request.employee.id } } : {}) };
const [items, total] = await Promise.all([
fastify.prisma.loanLender.findMany({ where, include: LENDER_INCLUDE, orderBy: [{ name: "asc" }, { id: "asc" }],
skip: (query.page - 1) * query.pageSize, take: query.pageSize }),