Browse Source

feat: new nested link api setup

pull/7558/head
Ramesh Mane 9 months ago
parent
commit
9682781bd2
  1. 3
      packages/nc-gui/composables/useMultiSelect/index.ts
  2. 25
      packages/nocodb/src/controllers/data-table.controller.ts
  3. 1531
      packages/nocodb/src/schema/swagger.json
  4. 20
      packages/nocodb/src/services/data-table.service.ts
  5. 2
      packages/nocodb/src/utils/acl.ts

3
packages/nc-gui/composables/useMultiSelect/index.ts

@ -982,8 +982,7 @@ export function useMultiSelect(
])
console.log('result', result)
await syncCellData?.(activeCell)
return
return await syncCellData?.(activeCell)
}
if (!isPasteable(rowObj, columnObj, true)) {

25
packages/nocodb/src/controllers/data-table.controller.ts

@ -193,4 +193,29 @@ export class DataTableController {
cookie: req,
});
}
@Post(['/api/v2/tables/:modelId/links/:columnId/records'])
@Acl('nestedDataLinkUnlink')
async nestedLinkUnlink(
@Req() req: Request,
@Param('modelId') modelId: string,
@Query('viewId') viewId: string,
@Param('columnId') columnId: string,
@Body()
data: {
operation: 'copy' | 'paste';
rowId: string;
}[],
) {
console.log('data', data);
return await this.dataTableService.nestedLinkUnlink({
modelId,
query: req.query,
viewId,
columnId,
data,
cookie: req,
});
}
}

1531
packages/nocodb/src/schema/swagger.json

File diff suppressed because it is too large Load Diff

20
packages/nocodb/src/services/data-table.service.ts

@ -8,6 +8,7 @@ import getAst from '~/helpers/getAst';
import { PagedResponseImpl } from '~/helpers/PagedResponse';
import { Column, Model, Source, View } from '~/models';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { validatePayload } from 'src/helpers';
@Injectable()
export class DataTableService {
@ -443,6 +444,25 @@ export class DataTableService {
return true;
}
async nestedLinkUnlink(param: {
cookie: any;
viewId: string;
modelId: string;
columnId: string;
query: any;
data: {
operation: 'copy' | 'paste';
rowId: string;
}[];
}) {
validatePayload(
'swagger.json#/components/schemas/NestedLinkUnlinkReq',
param.data,
);
return true;
}
private validateIds(rowIds: any[] | any) {
if (Array.isArray(rowIds)) {
const map = new Map<string, boolean>();

2
packages/nocodb/src/utils/acl.ts

@ -120,6 +120,7 @@ const permissionScopes = {
'nestedDataList',
'nestedDataLink',
'nestedDataUnlink',
'nestedDataLinkUnlink',
'baseUserList',
// Base API Tokens
@ -227,6 +228,7 @@ const rolePermissions:
nestedDataLink: true,
nestedDataUnlink: true,
nestedDataLinkUnlink: true,
// TODO add ACL with base scope
// upload: true,
// uploadViaURL: true,

Loading…
Cancel
Save