Browse Source

Merge pull request #7030 from nocodb/fix/7020-ltar-duplicate

fix: ignore duplicate item in  LTAR
pull/7035/head
Pranav C 1 year ago committed by GitHub
parent
commit
273ac81fb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      packages/nocodb/src/db/BaseModelSqlv2.ts

17
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -877,10 +877,13 @@ class BaseModelSqlv2 {
} }
async multipleHmList( async multipleHmList(
{ colId, ids }, { colId, ids: _ids }: { colId: string; ids: any[] },
args: { limit?; offset?; fieldsSet?: Set<string> } = {}, args: { limit?; offset?; fieldsSet?: Set<string> } = {},
) { ) {
try { try {
// skip duplicate id
const ids = [...new Set(_ids)];
const { where, sort, ...rest } = this._getListArgs(args as any); const { where, sort, ...rest } = this._getListArgs(args as any);
// todo: get only required fields // todo: get only required fields
@ -1136,9 +1139,17 @@ class BaseModelSqlv2 {
} }
public async multipleMmList( public async multipleMmList(
{ colId, parentIds }, {
colId,
parentIds: _parentIds,
}: {
colId: string;
parentIds: any[];
},
args: { limit?; offset?; fieldsSet?: Set<string> } = {}, args: { limit?; offset?; fieldsSet?: Set<string> } = {},
) { ) {
// skip duplicate id
const parentIds = [...new Set(_parentIds)];
const { where, sort, ...rest } = this._getListArgs(args as any); const { where, sort, ...rest } = this._getListArgs(args as any);
const relColumn = (await this.model.getColumns()).find( const relColumn = (await this.model.getColumns()).find(
(c) => c.id === colId, (c) => c.id === colId,
@ -1213,7 +1224,7 @@ class BaseModelSqlv2 {
}), }),
GROUP_COL, GROUP_COL,
); );
return parentIds.map((id) => gs[id] || []); return _parentIds.map((id) => gs[id] || []);
} }
public async mmList( public async mmList(

Loading…
Cancel
Save