const instructors = await db
.select()
.from(DBInstructors)
.where(
and(
department ? eq(DBInstructors.department, department) : undefined,
eq(DBInstructors.section, section)
)
)
.orderBy(
sortName === 'asc' ? asc(DBInstructors.name) : desc(DBInstructors.name)
)
.orderBy(
sortRating === 'lowest'
? asc(DBInstructors.rating)
: desc(DBInstructors.rating)
)
.offset(currentPage)
.limit(10);
const instructors = await db
.select()
.from(DBInstructors)
.where(
and(
department ? eq(DBInstructors.department, department) : undefined,
eq(DBInstructors.section, section)
)
)
.orderBy(
sortName === 'asc' ? asc(DBInstructors.name) : desc(DBInstructors.name)
)
.orderBy(
sortRating === 'lowest'
? asc(DBInstructors.rating)
: desc(DBInstructors.rating)
)
.offset(currentPage)
.limit(10);