Browse Source

fix: in shared meta api include Links related meta as well

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
4921bfacdb
  1. 5
      packages/nocodb/src/services/public-metas.service.ts

5
packages/nocodb/src/services/public-metas.service.ts

@ -1,5 +1,6 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { ErrorMessages, RelationTypes, UITypes } from 'nocodb-sdk'; import { ErrorMessages, RelationTypes, UITypes } from 'nocodb-sdk';
import { isLinksOrLTAR } from '../../../nocodb-sdk/src'
import { NcError } from '../helpers/catchError'; import { NcError } from '../helpers/catchError';
import { Base, Column, Model, Project, View } from '../models'; import { Base, Column, Model, Project, View } from '../models';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../models'; import type { LinkToAnotherRecordColumn, LookupColumn } from '../models';
@ -41,7 +42,7 @@ export class PublicMetasService {
column.pk || column.pk ||
view.model.columns.some( view.model.columns.some(
(c1) => (c1) =>
c1.uidt === UITypes.LinkToAnotherRecord && isLinksOrLTAR(c1.uidt) &&
(<LinkToAnotherRecordColumn>c1.colOptions).type === (<LinkToAnotherRecordColumn>c1.colOptions).type ===
RelationTypes.BELONGS_TO && RelationTypes.BELONGS_TO &&
view.columns.some((vc) => vc.fk_column_id === c1.id && vc.show) && view.columns.some((vc) => vc.fk_column_id === c1.id && vc.show) &&
@ -77,7 +78,7 @@ export class PublicMetasService {
col: Column<any>; col: Column<any>;
relatedMetas: Record<string, Model>; relatedMetas: Record<string, Model>;
}) { }) {
if (UITypes.LinkToAnotherRecord === col.uidt) { if (isLinksOrLTAR(col.uidt)) {
await this.extractLTARRelatedMetas({ await this.extractLTARRelatedMetas({
ltarColOption: await col.getColOptions<LinkToAnotherRecordColumn>(), ltarColOption: await col.getColOptions<LinkToAnotherRecordColumn>(),
relatedMetas, relatedMetas,

Loading…
Cancel
Save