Using extras in where

Hey, folks! Could you tell me, is it possible to get keys from "extras" in "where" for filtering?

let users = await db.query.UsersTable.findMany({
      extras: {
        targetName: sql<string>`lower(${UsersTable.firstName})`.as("target_name")
      },
      where: () =>
        and(
          inArray(
            UsersTable.id,
            employeesRoles.map((r) => r.userId)
          ),
          // here i need to use target_name for querying
        ),
      with: {
        roles: true
      }

  });
Was this page helpful?