error pass and select fix

This commit is contained in:
Julian Krauser 2024-12-16 13:56:22 +01:00
parent 7497787ae4
commit ac5a7e7427
2 changed files with 28 additions and 9 deletions

View file

@ -37,12 +37,20 @@ export async function executeQuery(req: Request, res: Response): Promise<any> {
let count = parseInt((req.query.count as string) ?? "25");
const query = req.body.query;
let [rows, total] = await DynamicQueryBuilder.buildQuery(query, offset, count).getManyAndCount();
try {
let [rows, total] = await DynamicQueryBuilder.buildQuery(query, offset, count).getManyAndCount();
res.json({
rows: rows,
total: total,
offset: offset,
count: count,
});
res.json({
rows: rows,
total: total,
offset: offset,
count: count,
});
} catch (error) {
res.status(500).send({
json: error.sql,
code: error.code,
msg: error.sqlMessage,
});
}
}