Browse Source

fix: use oldDatasService instead

pull/5444/head
Wing-Kam Wong 2 years ago committed by Pranav C
parent
commit
a61359e809
  1. 45
      packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts

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

@ -16,23 +16,17 @@ import {
} from '../../../middlewares/extract-project-id/extract-project-id.middleware';
import { AuthGuard } from '@nestjs/passport';
import { Project } from 'src/models';
import { DatasService } from '../datas.service';
import { OldDatasService } from './old-datas.service';
@Controller()
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt'))
export class OldDatasController {
constructor(private readonly datasService: DatasService) {}
constructor(private readonly oldDatasService: OldDatasService) {}
@Get('/nc/:projectId/api/v1/:tableName')
@Acl('dataList')
async dataList(@Request() req) {
const { model, view } =
await this.datasService.getViewAndModelFromRequestByAliasOrId(req);
return await this.datasService.getDataList({
model,
view,
query: req.query,
});
async dataList(@Request() req, @Response() res) {
res.json(await this.oldDatasService.getDataList(req));
}
@Get('/nc/:projectId/api/v1/:tableName/count')
@ -42,37 +36,12 @@ export class OldDatasController {
@Response() res,
@Param('tableName') tableName: string,
) {
const { model, view } =
await this.datasService.getViewAndModelFromRequestByAliasOrId(req);
const project = await Project.get(model.project_id);
const countResult = await this.datasService.dataCount({
query: req.query,
projectName: project.title,
tableName: tableName,
viewName: view.title,
});
res.json(countResult);
res.json(await this.oldDatasService.getDataCount(req));
}
@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,
}),
);
async dataInsert(@Request() req, @Response() res) {
res.json(await this.oldDatasService.dataInsert(req));
}
}

Loading…
Cancel
Save