Search Relation table
Hi, I'm building a searching feature, and one of the columns "invoice" has a relation to a different table "customer".
I'd like to know how can I access the name of the customer within the invoice. Here's the code:
Thanks in advance
I'd like to know how can I access the name of the customer within the invoice. Here's the code:
import { getXataClient } from "@/app/xata";
const xata = getXataClient();
export const searchInvoice = async (phrase: string) => {
const results = await xata.db.invoice.search(phrase, {
target: ["customer.name", "products", "address"],
fuzziness: 1,
prefix: "phrase",
});
return results;
};
Thanks in advance