|
|
@ -50,7 +50,11 @@ export async function dataList(req: Request, res: Response) { |
|
|
|
listArgs.sortArr = JSON.parse(listArgs.sortArrJson); |
|
|
|
listArgs.sortArr = JSON.parse(listArgs.sortArrJson); |
|
|
|
} catch (e) {} |
|
|
|
} catch (e) {} |
|
|
|
|
|
|
|
|
|
|
|
const data = await nocoExecute( |
|
|
|
let data = []; |
|
|
|
|
|
|
|
let count = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
data = await nocoExecute( |
|
|
|
await getAst({ |
|
|
|
await getAst({ |
|
|
|
query: req.query, |
|
|
|
query: req.query, |
|
|
|
model, |
|
|
|
model, |
|
|
@ -60,8 +64,11 @@ export async function dataList(req: Request, res: Response) { |
|
|
|
{}, |
|
|
|
{}, |
|
|
|
listArgs |
|
|
|
listArgs |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
count = await baseModel.count(listArgs); |
|
|
|
const count = await baseModel.count(listArgs); |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
// show empty result instead of throwing error here
|
|
|
|
|
|
|
|
// e.g. search some text in a numeric field
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
res.json({ |
|
|
|
res.json({ |
|
|
|
data: new PagedResponseImpl(data, { ...req.query, count }), |
|
|
|
data: new PagedResponseImpl(data, { ...req.query, count }), |
|
|
@ -198,14 +205,20 @@ async function relDataList(req, res) { |
|
|
|
extractOnlyPrimaries: true, |
|
|
|
extractOnlyPrimaries: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const data = await nocoExecute( |
|
|
|
let data = []; |
|
|
|
|
|
|
|
let count = 0; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
data = data = await nocoExecute( |
|
|
|
requestObj, |
|
|
|
requestObj, |
|
|
|
await baseModel.list(req.query), |
|
|
|
await baseModel.list(req.query), |
|
|
|
{}, |
|
|
|
{}, |
|
|
|
req.query |
|
|
|
req.query |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
count = await baseModel.count(req.query); |
|
|
|
const count = await baseModel.count(req.query); |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
// show empty result instead of throwing error here
|
|
|
|
|
|
|
|
// e.g. search some text in a numeric field
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
res.json(new PagedResponseImpl(data, { ...req.query, count })); |
|
|
|
res.json(new PagedResponseImpl(data, { ...req.query, count })); |
|
|
|
} |
|
|
|
} |
|
|
|