feat: set exclude privilege on report api

pull/28/head
Firman Ramdhani 2024-07-15 18:06:25 +07:00
parent bad83aef69
commit eaa1e64899
3 changed files with 18 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import {
Query,
} from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import { ExcludePrivilege, Public } from 'src/core/guards';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import {
GetLabelReportBookmarkDto,
@ -26,11 +26,13 @@ export class ReportBookmarkController {
constructor(private service: ReportBookmarkService) {}
@Post()
@ExcludePrivilege()
async create(@Body() body: CreateReportBookmarkDto) {
return await this.service.create(body);
}
@Get()
@ExcludePrivilege()
async getAll(@Query() query: GetReportBookmarkDto) {
return await this.service.getAll(query);
}
@ -41,26 +43,31 @@ export class ReportBookmarkController {
// }
@Get('label-history')
@ExcludePrivilege()
async getAllLabelHistory(@Query() query: GetLabelReportBookmarkDto) {
return await this.service.getAllLabelHistory(query);
}
@Get('applied')
@ExcludePrivilege()
async currentApplied(@Query() query: GetLabelReportBookmarkDto) {
return await this.service.getCurrentAppliedBookmark(query);
}
@Put('applied/:id')
@ExcludePrivilege()
async applied(@Param('id') id: string) {
return await this.service.applied(id);
}
@Put('unapplied/:id')
@ExcludePrivilege()
async unapplied(@Param('id') id: string) {
return await this.service.unapplied(id);
}
@Delete(':id')
@ExcludePrivilege()
async delete(@Param('id') id: string) {
return await this.service.delete(id);
}

View File

@ -8,7 +8,7 @@ import {
Query,
} from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import { ExcludePrivilege, Public } from 'src/core/guards';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { CreateReportExportDto } from '../shared/dto/report-export.create.dto';
import {
@ -26,27 +26,32 @@ export class ReportExportController {
constructor(private service: ReportExportService) {}
@Post()
@ExcludePrivilege()
async create(@Body() body: CreateReportExportDto) {
await this.service.create(body);
return { message: 'Processing request export data.' };
}
@Get()
@ExcludePrivilege()
async getAll(@Query() query: GetReportExportDto) {
return await this.service.getAll(query);
}
@Delete(':id')
@ExcludePrivilege()
async delete(@Param('id') id: string) {
return await this.service.delete(id);
}
@Get('processing')
@ExcludePrivilege()
async getAllProcessing(@Query() query: GetReportExportProcessingDto) {
return await this.service.getAllProcessing(query);
}
@Get('filename-history')
@ExcludePrivilege()
async getListHistoryFileName(@Query() query: GetReportExportFileNameDto) {
return await this.service.getListHistoryFileName(query);
}

View File

@ -1,6 +1,6 @@
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import { ExcludePrivilege, Public } from 'src/core/guards';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { ReportService } from './report.service';
import { GetReportConfigDto } from '../shared/dto/report-config.get.dto';
@ -13,16 +13,19 @@ import { GetReportDataDto } from '../shared/dto/report-data.get.dto';
export class ReportController {
constructor(private service: ReportService) {}
@Get('config')
@ExcludePrivilege()
async getReportConfig(@Query() query: GetReportConfigDto) {
return await this.service.getReportConfig(query);
}
@Post('data')
@ExcludePrivilege()
async getReportData(@Body() body: GetReportDataDto) {
return await this.service.getReportData(body);
}
@Post('meta')
@ExcludePrivilege()
async getReportMeta(@Body() body: GetReportDataDto) {
return await this.service.getReportMeta(body);
}