|
|
@ -135,8 +135,19 @@ export default class NcMetaMgrEE extends NcMetaMgr { |
|
|
|
?.apiBuilders?.find(ab => ab.dbAlias === viewMeta.db_alias); |
|
|
|
?.apiBuilders?.find(ab => ab.dbAlias === viewMeta.db_alias); |
|
|
|
const model = apiBuilder?.xcModels?.[viewMeta.model_name]; |
|
|
|
const model = apiBuilder?.xcModels?.[viewMeta.model_name]; |
|
|
|
|
|
|
|
|
|
|
|
if (model) { |
|
|
|
let meta = apiBuilder?.getMeta(viewMeta.model_name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!model) { |
|
|
|
|
|
|
|
throw new Error('Meta not found'); |
|
|
|
|
|
|
|
} |
|
|
|
const queryParams = JSON.parse(viewMeta.query_params); |
|
|
|
const queryParams = JSON.parse(viewMeta.query_params); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!meta) throw new Error('Meta not found'); |
|
|
|
|
|
|
|
meta = { |
|
|
|
|
|
|
|
...meta, |
|
|
|
|
|
|
|
columns: meta.columns.filter(c => queryParams?.showFields?.[c._cn]) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let where = ''; |
|
|
|
let where = ''; |
|
|
|
|
|
|
|
|
|
|
|
if (req.query.where) { |
|
|
|
if (req.query.where) { |
|
|
@ -151,7 +162,7 @@ export default class NcMetaMgrEE extends NcMetaMgr { |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
model_name: viewMeta.model_name, |
|
|
|
model_name: viewMeta.model_name, |
|
|
|
meta: JSON.parse(viewMeta.meta), |
|
|
|
meta, |
|
|
|
data: await model.list({ |
|
|
|
data: await model.list({ |
|
|
|
...req.query, |
|
|
|
...req.query, |
|
|
|
where, |
|
|
|
where, |
|
|
@ -164,7 +175,6 @@ export default class NcMetaMgrEE extends NcMetaMgr { |
|
|
|
})), |
|
|
|
})), |
|
|
|
client: apiBuilder?.client |
|
|
|
client: apiBuilder?.client |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
@ -173,12 +183,12 @@ export default class NcMetaMgrEE extends NcMetaMgr { |
|
|
|
protected async createSharedViewLink(req, args: any): Promise<any> { |
|
|
|
protected async createSharedViewLink(req, args: any): Promise<any> { |
|
|
|
try { |
|
|
|
try { |
|
|
|
// todo: keep belongs to column if belongs to virtual column present
|
|
|
|
// todo: keep belongs to column if belongs to virtual column present
|
|
|
|
if (args.args.query_params?.fields && args.args.show_as !== 'form') { |
|
|
|
// if (args.args.query_params?.fields && args.args.show_as !== 'form') {
|
|
|
|
const fields = args.args.query_params?.fields.split(','); |
|
|
|
// const fields = args.args.query_params?.fields.split(',');
|
|
|
|
args.args.meta.columns = args.args.meta.columns.filter(c => |
|
|
|
// args.args.meta.columns = args.args.meta.columns.filter(c =>
|
|
|
|
fields.includes(c._cn) |
|
|
|
// fields.includes(c._cn)
|
|
|
|
); |
|
|
|
// );
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
const insertData = { |
|
|
|
const insertData = { |
|
|
|
project_id: args.project_id, |
|
|
|
project_id: args.project_id, |
|
|
|