Browse Source

feat: OldDatasController - dataCount

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

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

@ -8,12 +8,14 @@ import {
Patch, Patch,
Post, Post,
Request, Request,
Response,
} from '@nestjs/common'; } from '@nestjs/common';
import { import {
Acl, Acl,
ExtractProjectIdMiddleware, ExtractProjectIdMiddleware,
} from '../../../middlewares/extract-project-id/extract-project-id.middleware'; } from '../../../middlewares/extract-project-id/extract-project-id.middleware';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { Project } from 'src/models';
import { DatasService } from '../datas.service'; import { DatasService } from '../datas.service';
@Controller() @Controller()
@ -32,4 +34,23 @@ export class OldDatasController {
query: req.query, query: req.query,
}); });
} }
@Get('/nc/:projectId/api/v1/:tableName/count')
@Acl('dataCount')
async dataCount(
@Request() req,
@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);
}
} }

Loading…
Cancel
Save