Browse Source

fix: OldData - dataInsert

pull/5444/head
Wing-Kam Wong 1 year ago committed by Pranav C
parent
commit
77347a3d4a
  1. 18
      packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts
  2. 6
      packages/nocodb-nest/src/modules/datas/old-datas/old-datas.service.ts

18
packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts

@ -48,7 +48,13 @@ export class OldDatasController {
@Param('projectId') projectId: string,
@Param('tableName') tableName: string,
) {
res.json(await this.oldDatasService.getDataCount(req));
res.json(
await this.oldDatasService.dataCount({
query: req.query,
projectId: projectId,
tableName: tableName,
}),
);
}
@Post('/nc/:projectId/api/v1/:tableName')
@ -58,8 +64,16 @@ export class OldDatasController {
@Response() res,
@Param('projectId') projectId: string,
@Param('tableName') tableName: string,
@Body() body: any,
) {
res.json(await this.oldDatasService.dataInsert(req));
res.json(
await this.oldDatasService.dataInsert({
projectId: projectId,
tableName: tableName,
body: body,
cookie: req,
}),
);
}
@Get('/nc/:projectId/api/v1/:tableName/:rowId')

6
packages/nocodb-nest/src/modules/datas/old-datas/old-datas.service.ts

@ -43,7 +43,7 @@ export class OldDatasService {
return await nocoExecute(ast, await baseModel.list(listArgs), {}, listArgs);
}
async getDataCount(param: OldPathParams & { query: any }) {
async dataCount(param: OldPathParams & { query: any }) {
const { model, view } = await this.getViewAndModelFromRequest(param);
const base = await Base.get(model.base_id);
@ -61,7 +61,7 @@ export class OldDatasService {
return await baseModel.count(listArgs);
}
async dataInsert(param: OldPathParams & { body: unknown }) {
async dataInsert(param: OldPathParams & { body: unknown; cookie: any }) {
const { model, view } = await this.getViewAndModelFromRequest(param);
const base = await Base.get(model.base_id);
@ -72,7 +72,7 @@ export class OldDatasService {
dbDriver: await NcConnectionMgrv2.get(base),
});
return await baseModel.insert(param.body, null, param);
return await baseModel.insert(param.body, null, param.cookie);
}
async dataRead(param: OldPathParams & { query: any; rowId: string }) {

Loading…
Cancel
Save