import { generalEvaluations } from "@/db/schema"; import { eq, inArray, not, asc, desc, and, ilike, gte, lte, count, gt, } from "drizzle-orm"; import { PgTransaction } from "drizzle-orm/pg-core"; export async function selectGeneralCheckLists( tx: PgTransaction, params: { where?: any; orderBy?: (ReturnType | ReturnType)[]; offset?: number; limit?: number; } ) { const { where, orderBy, offset = 0, limit = 10 } = params; return await tx .select() .from(generalEvaluations) .where(where) .orderBy(...(orderBy ?? [asc(generalEvaluations.createdAt)])) .offset(offset ?? 0) .limit(limit ?? 10); } export async function countGeneralCheckList( tx: PgTransaction, where?: any ) { const result = await tx .select({ count: count() }) .from(generalEvaluations) .where(where); return result[0]?.count ?? 0; }