I am getting an Internal server error while query with a special character.
.where(
new Brackets((qb) => {
qb.where(`university.status = 'Active'`);
if (data.filter && Object.keys(data.filter).length > 0) {
Object.keys(data.filter).forEach(function (key) {
// check condition operand
if (key.includes('Id')) {
condOperand = ' = ';
likeOp = '';
} else {
condOperand = ' ILIKE ';
likeOp = '%';
}
qb.andWhere(
`university.${key} ${condOperand} ('${likeOp}${data.filter[key]}${likeOp}')`,
);
});
}
}),
)
Payload
{
"filter": {
"universityName": "Bishop's University"
},
"pageNumber": 1,
"pageSize": 10,
"sortField": "universityId",
"sortOrder": "ASC"
}
I have see in filter at university name. Code works fine with out '. How can I fix that ?