Browse Source

fix: make sure BaseModelSqlv2 have viewId

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5624/head
mertmit 2 years ago
parent
commit
25c8ad21da
  1. 5
      packages/nocodb/src/models/Model.ts

5
packages/nocodb/src/models/Model.ts

@ -339,6 +339,11 @@ export default class Model implements TableType {
): Promise<BaseModelSqlv2> { ): Promise<BaseModelSqlv2> {
const model = args?.model || (await this.get(args.id, ncMeta)); const model = args?.model || (await this.get(args.id, ncMeta));
if (!args?.viewId) {
const view = await View.getDefaultView(model.id, ncMeta);
args.viewId = view.id;
}
return new BaseModelSqlv2({ return new BaseModelSqlv2({
dbDriver: args.dbDriver, dbDriver: args.dbDriver,
viewId: args.viewId, viewId: args.viewId,

Loading…
Cancel
Save