From 94bff22c2310b35365ed2672e661604a8e7391c9 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 11 Apr 2023 13:11:24 +0800 Subject: [PATCH] feat: OldDatasController - dataInsert --- .../datas/old-datas/old-datas.controller.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts b/packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts index 70c1352379..dae3591a87 100644 --- a/packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts +++ b/packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts @@ -53,4 +53,26 @@ export class OldDatasController { }); res.json(countResult); } + + @Post('/nc/:projectId/api/v1/:tableName') + @Acl('dataInsert') + async dataInsert( + @Request() req, + @Response() res, + @Param('tableName') tableName: string, + @Body() body: any, + ) { + const { model, view } = + await this.datasService.getViewAndModelFromRequestByAliasOrId(req); + const project = await Project.get(model.project_id); + return res.json( + await this.datasService.dataInsert({ + projectName: project.title, + tableName: tableName, + viewName: view.title, + body: body, + cookie: req, + }), + ); + } }