const whereClause = []
if (zipCodeLike && zipCodeLike.length > 0) {
const clauses = zipCodeLike.map((_, index) =>
index === 0 ? ` recentZIPCode LIKE ` : ` OR recentZIPCode LIKE `,
);
whereClause.push(Prisma.sql([...clauses, ""], ...zipCodeLike));
}
if (nameLike && nameLike.length > 0) {
const clauses = nameLike.map((_, index) =>
index === 0 ? ` name LIKE ` : ` OR name LIKE `,
);
whereClause.push(Prisma.sql([...clauses, ""], ...nameLike));
}
//How do I construct the where clause into a queryRaw
// in a way that they have brackets and AND between them? I tried explaining ChatGPT that the Prisma.join function is only for values but it cannot wrap it's processor around it. Perhaps what I am trying to do is impossible (and hence maybe bad)
const whereClause = []
if (zipCodeLike && zipCodeLike.length > 0) {
const clauses = zipCodeLike.map((_, index) =>
index === 0 ? ` recentZIPCode LIKE ` : ` OR recentZIPCode LIKE `,
);
whereClause.push(Prisma.sql([...clauses, ""], ...zipCodeLike));
}
if (nameLike && nameLike.length > 0) {
const clauses = nameLike.map((_, index) =>
index === 0 ? ` name LIKE ` : ` OR name LIKE `,
);
whereClause.push(Prisma.sql([...clauses, ""], ...nameLike));
}
//How do I construct the where clause into a queryRaw
// in a way that they have brackets and AND between them? I tried explaining ChatGPT that the Prisma.join function is only for values but it cannot wrap it's processor around it. Perhaps what I am trying to do is impossible (and hence maybe bad)