Browse Source

chore: lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5379/head
Pranav C 2 years ago
parent
commit
12c5f6f0a7
  1. 11
      packages/nocodb/src/lib/controllers/dbData/oldData.ctl.ts
  2. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
  3. 2
      packages/nocodb/src/lib/services/dbData/helpers.ts
  4. 37
      packages/nocodb/src/lib/services/dbData/index.ts
  5. 20
      packages/nocodb/src/lib/services/public/publicData.svc.ts

11
packages/nocodb/src/lib/controllers/dbData/oldData.ctl.ts

@ -132,19 +132,14 @@ async function dataRead(req: Request, res: Response) {
dbDriver: await NcConnectionMgrv2.get(base),
});
const {ast} = await getAst({
const { ast } = await getAst({
query: req.query,
model,
view,
})
});
res.json(
await nocoExecute(
ast ,
await baseModel.readByPk(req.params.rowId),
{},
{}
)
await nocoExecute(ast, await baseModel.readByPk(req.params.rowId), {}, {})
);
}

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

@ -836,7 +836,7 @@ export default async function formulaQueryBuilderv2(
tableAlias
);
if(!validateFormula) return qb;
if (!validateFormula) return qb;
try {
// dry run qb.builder to see if it will break the grid view or not

2
packages/nocodb/src/lib/services/dbData/helpers.ts

@ -242,7 +242,7 @@ export async function getDbRows(param: {
temp = process.hrtime(startTime),
elapsed = temp[0] * 1000 + temp[1] / 1000000
) {
const {ast, dependencyFields} = await getAst({
const { ast, dependencyFields } = await getAst({
query: query,
includePkByDefault: false,
model: view.model,

37
packages/nocodb/src/lib/services/dbData/index.ts

@ -116,7 +116,6 @@ export async function getDataList(param: {
const { ast, dependencyFields } = await getAst({ model, query, view });
const listArgs: any = dependencyFields;
try {
listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
@ -128,12 +127,7 @@ export async function getDataList(param: {
let data = [];
let count = 0;
try {
data = await nocoExecute(
ast,
await baseModel.list(listArgs),
{},
listArgs
);
data = await nocoExecute(ast, await baseModel.list(listArgs), {}, listArgs);
count = await baseModel.count(listArgs);
} catch (e) {
console.log(e);
@ -171,17 +165,10 @@ export async function getFindOne(param: {
args.sortArr = JSON.parse(args.sortArrJson);
} catch (e) {}
const {ast, dependencyFields} = await getAst({ model, query: args, view })
const { ast, dependencyFields } = await getAst({ model, query: args, view });
const data = await baseModel.findOne({ ...args, dependencyFields });
return data
? await nocoExecute(
ast,
data,
{},
{}
)
: {};
return data ? await nocoExecute(ast, data, {}, {}) : {};
}
export async function getDataGroupBy(param: {
@ -228,14 +215,9 @@ export async function dataRead(
NcError.notFound('Row not found');
}
const { ast, dependencyFields } = await getAst({ model, query: param.query, view })
const { ast } = await getAst({ model, query: param.query, view });
return await nocoExecute(
ast,
row,
{},
param.query
);
return await nocoExecute(ast, row, {}, param.query);
}
export async function dataExist(
@ -303,12 +285,7 @@ export async function getGroupedDataList(param: {
...listArgs,
groupColumnId: param.columnId,
});
data = await nocoExecute(
{ key: 1, value: ast },
groupedData,
{},
listArgs
);
data = await nocoExecute({ key: 1, value: ast }, groupedData, {}, listArgs);
const countArr = await baseModel.groupedListCount({
...listArgs,
groupColumnId: param.columnId,
@ -655,7 +632,7 @@ export async function dataReadByViewId(param: {
dbDriver: await NcConnectionMgrv2.get(base),
});
const { ast } = await getAst({ model, query: param.query })
const { ast } = await getAst({ model, query: param.query });
return await nocoExecute(
ast,

20
packages/nocodb/src/lib/services/public/publicData.svc.ts

@ -63,21 +63,16 @@ export async function dataList(param: {
query: param.query,
model,
view,
})
});
data = await nocoExecute(
ast,
await baseModel.list(listArgs),
{},
listArgs
);
data = await nocoExecute(ast, await baseModel.list(listArgs), {}, listArgs);
count = await baseModel.count(listArgs);
} catch (e) {
console.log(e)
console.log(e);
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
NcError.internalServerError('Please try after some time')
NcError.internalServerError('Please try after some time');
}
return new PagedResponseImpl(data, { ...param.query, count });
@ -153,12 +148,7 @@ async function getGroupedDataList(param: {
...listArgs,
groupColumnId,
});
data = await nocoExecute(
{ key: 1, value: ast },
groupedData,
{},
listArgs
);
data = await nocoExecute({ key: 1, value: ast }, groupedData, {}, listArgs);
const countArr = await baseModel.groupedListCount({
...listArgs,
groupColumnId,

Loading…
Cancel
Save