Skip to content

Commit

Permalink
Merge pull request #65 from Deep-Consulting-Solutions/metadata-sync-i…
Browse files Browse the repository at this point in the history
…ssue

chore: removed unncessary logs
  • Loading branch information
horpeazy authored Jul 30, 2024
2 parents f746eaa + dfb913e commit 356422d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions packages/nocodb/src/lib/models/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,25 @@ export default class Project implements ProjectType {

// @ts-ignore
static async get(projectId: string, ncMeta = Noco.ncMeta): Promise<Project> {
console.log('about to check cache for project data');
// console.log('about to check cache for project data');
let projectData =
projectId &&
(await NocoCache.get(
`${CacheScope.PROJECT}:${projectId}`,
CacheGetType.TYPE_OBJECT
));
console.log('Finished getting project data from cache');
// console.log('Finished getting project data from cache');
if (!projectData) {
console.log('about to check db for project data');
// console.log('about to check db for project data');
projectData = await ncMeta.metaGet2(null, null, MetaTable.PROJECT, {
id: projectId,
deleted: false,
});
console.log('Finished getting Db for project data from cache');
console.log({ projectData });
console.log('about to set projectdata in cache');
// console.log('Finished getting Db for project data from cache');
// console.log({ projectData });
// console.log('about to set projectdata in cache');
await NocoCache.set(`${CacheScope.PROJECT}:${projectId}`, projectData);
console.log('finished to setting projectdata in cache');
// console.log('finished to setting projectdata in cache');
} else {
if (projectData.deleted) {
projectData = null;
Expand Down
10 changes: 5 additions & 5 deletions packages/nocodb/src/lib/services/dbData/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ export async function getViewAndModelByAliasOrId(param: {
tableName: string;
viewName?: string;
}) {
log('about to fetch project in getViewAndModelByAliasOrId');
// log('about to fetch project in getViewAndModelByAliasOrId');
const project = await Project.getWithInfoByTitleOrId(param.projectName);
log('fetched project in getViewAndModelByAliasOrId ...');
log(JSON.stringify({ project }));
// log('fetched project in getViewAndModelByAliasOrId ...');
// log(JSON.stringify({ project }));

const model = await Model.getByAliasOrId({
project_id: project.id,
aliasOrId: param.tableName,
});
log(JSON.stringify({ model }));
// log(JSON.stringify({ model }));

const view =
param.viewName &&
(await View.getByTitleOrId({
titleOrId: param.viewName,
fk_model_id: model.id,
}));
log(JSON.stringify({ view }))
// log(JSON.stringify({ view }))
if (!model) NcError.notFound('Table not found');
return { model, view };
}
Expand Down
32 changes: 16 additions & 16 deletions packages/nocodb/src/lib/services/dbData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,24 @@ export async function getDataList(param: {
// ////////// add logs here to see cause of slow
const { model, view, query = {} } = param;

console.log('getDataList about to get base ...');
// console.log('getDataList about to get base ...');
const base = await Base.get(model.base_id);
console.log('getDataList finished getting base ...');
// console.log('getDataList finished getting base ...');

console.log('getDataList about to get model ...');
// console.log('getDataList about to get model ...');
const baseModel = await Model.getBaseModelSQL({
id: model.id,
viewId: view?.id,
dbDriver: await NcConnectionMgrv2.get(base),
});
console.log('getDataList finished getting model ...');
// console.log('getDataList finished getting model ...');

console.log('getDataList about to get ast ....');
log(JSON.stringify({ model }));
log(JSON.stringify({ query }));
log(JSON.stringify({ view }));
// console.log('getDataList about to get ast ....');
// log(JSON.stringify({ model }));
// log(JSON.stringify({ query }));
// log(JSON.stringify({ view }));
const { ast, dependencyFields } = await getAst({ model, query, view });
console.log('getDataList finished getting ast ....');
// console.log('getDataList finished getting ast ....');

const listArgs: any = dependencyFields;
try {
Expand All @@ -146,21 +146,21 @@ export async function getDataList(param: {
let data = [];
let count = 0;
try {
console.log('getDataList about to get data ....');
log(JSON.stringify({ ast }));
log(JSON.stringify({ listArgs }));
// console.log('getDataList about to get data ....');
// log(JSON.stringify({ ast }));
// log(JSON.stringify({ listArgs }));
data = await nocoExecute(ast, await baseModel.list(listArgs), {}, listArgs);
console.log('getDataList finished getting data ....');
// console.log('getDataList finished getting data ....');

console.log('getDataList about to get count ....');
// console.log('getDataList about to get count ....');
count = await baseModel.count(listArgs);
console.log('getDataList finished getting count ....');
// console.log('getDataList finished getting count ....');
} catch (e) {
console.log(e);
NcError.internalServerError('Please check server log for more details');
}

log(JSON.stringify({ data }));
// log(JSON.stringify({ data }));

return new PagedResponseImpl(data, {
...query,
Expand Down

0 comments on commit 356422d

Please sign in to comment.