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

View File

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

View File

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