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