Merge pull request 'feat: setup api for get label history on bookmark' (#10) from feat/report into development

Reviewed-on: #10
pull/13/head
firmanr 2024-07-03 05:22:18 +00:00
commit 6bb8c928c0
7 changed files with 110 additions and 17 deletions

View File

@ -11,36 +11,47 @@ import {
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards'; import { 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 { GetReportBookmarkDto } from '../shared/dto/report-bookmark.get.dto'; import {
GetLabelReportBookmarkDto,
GetReportBookmarkDto,
} from '../shared/dto/report-bookmark.get.dto';
import { CreateReportBookmarkDto } from '../shared/dto/report-bookmark.create.dto'; import { CreateReportBookmarkDto } from '../shared/dto/report-bookmark.create.dto';
import { ReportBookmarkService } from './report-bookmark.service';
@ApiTags(`${MODULE_NAME.REPORT_BOOKMARK.split('-').join(' ')}`) @ApiTags(`${MODULE_NAME.REPORT_BOOKMARK.split('-').join(' ')}`)
@Controller(`v1/${MODULE_NAME.REPORT_BOOKMARK}`) @Controller(`v1/${MODULE_NAME.REPORT_BOOKMARK}`)
@Public(false) @Public(false)
@ApiBearerAuth('JWT') @ApiBearerAuth('JWT')
export class ReportBookmarkController { export class ReportBookmarkController {
constructor(private service: ReportBookmarkService) {}
@Post() @Post()
async create(@Body() body: CreateReportBookmarkDto) { async create(@Body() body: CreateReportBookmarkDto) {
return; return await this.service.create(body);
} }
@Get() @Get()
async getAll(@Query() query: GetReportBookmarkDto) { async getAll(@Query() query: GetReportBookmarkDto) {
return; return await this.service.getAll(query);
}
@Get('label-history')
async getAllLabelHistory(@Query() query: GetLabelReportBookmarkDto) {
return await this.service.getAllLabelHistory(query);
} }
@Put('applied/:id') @Put('applied/:id')
async applied(@Param('id') id: string) { async applied(@Param('id') id: string) {
return; return await this.service.applied(id);
} }
@Put('unapplied/:id') @Put('unapplied/:id')
async unapplied(@Param('id') id: string) { async unapplied(@Param('id') id: string) {
return; return await this.service.unapplied(id);
} }
@Delete(':id') @Delete(':id')
async delete(@Param('id') id: string) { async delete(@Param('id') id: string) {
return; return await this.service.delete(id);
} }
} }

View File

@ -1,5 +1,34 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { BaseReportService } from '../shared/services/base-report.service'; import { BaseReportService } from '../shared/services/base-report.service';
import { CreateReportBookmarkDto } from '../shared/dto/report-bookmark.create.dto';
import {
GetLabelReportBookmarkDto,
GetReportBookmarkDto,
} from '../shared/dto/report-bookmark.get.dto';
@Injectable() @Injectable()
export class ReportBookmarkService extends BaseReportService {} export class ReportBookmarkService extends BaseReportService {
async create(body: CreateReportBookmarkDto) {
return 'you hit API for create report bookmark';
}
async getAll(query: GetReportBookmarkDto) {
return 'you hit API for get all report bookmark';
}
async getAllLabelHistory(query: GetLabelReportBookmarkDto) {
return 'you hit API for get all label history report bookmark';
}
async applied(id: string) {
return 'you hit API for applied report bookmark';
}
async unapplied(id: string) {
return 'you hit API for unapplied report bookmark';
}
async delete(id: string) {
return 'you hit API for delete report bookmark';
}
}

View File

@ -17,34 +17,37 @@ import {
GetReportExportFileNameDto, GetReportExportFileNameDto,
GetReportExportProcessingDto, GetReportExportProcessingDto,
} from '../shared/dto/report-export.get.dto'; } from '../shared/dto/report-export.get.dto';
import { ReportExportService } from './report-export.service';
@ApiTags(`${MODULE_NAME.REPORT_EXPORT.split('-').join(' ')}`) @ApiTags(`${MODULE_NAME.REPORT_EXPORT.split('-').join(' ')}`)
@Controller(`v1/${MODULE_NAME.REPORT_EXPORT}`) @Controller(`v1/${MODULE_NAME.REPORT_EXPORT}`)
@Public(false) @Public(false)
@ApiBearerAuth('JWT') @ApiBearerAuth('JWT')
export class ReportExportController { export class ReportExportController {
constructor(private service: ReportExportService) {}
@Post() @Post()
async create(@Body() body: CreateReportExportDto) { async create(@Body() body: CreateReportExportDto) {
return; return await this.service.create(body);
} }
@Get() @Get()
async getAll(@Query() query: GetReportExportDto) { async getAll(@Query() query: GetReportExportDto) {
return; return await this.service.getAll(query);
} }
@Delete(':id') @Delete(':id')
async delete(@Param('id') id: string) { async delete(@Param('id') id: string) {
return; return await this.service.delete(id);
} }
@Get('processing') @Get('processing')
async getAllProcessing(@Query() query: GetReportExportProcessingDto) { async getAllProcessing(@Query() query: GetReportExportProcessingDto) {
return; return await this.service.getAllProcessing(query);
} }
@Get('filename-history') @Get('filename-history')
async getListHistoryFileName(@Query() query: GetReportExportFileNameDto) { async getListHistoryFileName(@Query() query: GetReportExportFileNameDto) {
return; return await this.service.getListHistoryFileName(query);
} }
} }

View File

@ -1,5 +1,31 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { BaseReportService } from '../shared/services/base-report.service'; import { BaseReportService } from '../shared/services/base-report.service';
import { CreateReportExportDto } from '../shared/dto/report-export.create.dto';
import {
GetReportExportDto,
GetReportExportFileNameDto,
GetReportExportProcessingDto,
} from '../shared/dto/report-export.get.dto';
@Injectable() @Injectable()
export class ReportExportService extends BaseReportService {} export class ReportExportService extends BaseReportService {
async create(body: CreateReportExportDto) {
return 'you hit API for create report export';
}
async getAll(query: GetReportExportDto) {
return 'you hit API for get all report export';
}
async delete(id: string) {
return 'you hit API for delete report export';
}
async getAllProcessing(query: GetReportExportProcessingDto) {
return 'you hit API for get all processing report export';
}
async getListHistoryFileName(query: GetReportExportFileNameDto) {
return 'you hit API for get all file name report export';
}
}

View File

@ -6,10 +6,10 @@ import { GetReportDataDto } from '../shared/dto/report-data.get.dto';
@Injectable() @Injectable()
export class ReportService extends BaseReportService { export class ReportService extends BaseReportService {
async getReportConfig(query: GetReportConfigDto) { async getReportConfig(query: GetReportConfigDto) {
return this.getUser(); return 'you hit API for get report config';
} }
async getReportData(body: GetReportDataDto) { async getReportData(body: GetReportDataDto) {
return this.getUser(); return 'you hit API for get report data';
} }
} }

View File

@ -19,8 +19,12 @@ export class CreateReportBookmarkDto {
@IsBoolean() @IsBoolean()
applied: boolean; applied: boolean;
@ApiProperty({ name: 'type', required: true }) @ApiProperty({
@IsBoolean() name: 'type',
required: true,
default: REPORT_BOOKMARK_TYPE.TABLE_CONFIG,
})
@IsString()
type: REPORT_BOOKMARK_TYPE; type: REPORT_BOOKMARK_TYPE;
@ApiProperty({ @ApiProperty({

View File

@ -21,3 +21,23 @@ export class GetReportBookmarkDto {
}) })
types?: REPORT_BOOKMARK_TYPE[]; types?: REPORT_BOOKMARK_TYPE[];
} }
export class GetLabelReportBookmarkDto {
@ApiProperty({ type: ['string'], required: false })
@Transform((body) => {
return Array.isArray(body.value) ? body.value : [body.value];
})
group_names?: string;
@ApiProperty({ type: ['string'], required: false })
@Transform((body) => {
return Array.isArray(body.value) ? body.value : [body.value];
})
unique_names?: string[];
@ApiProperty({ type: ['string'], required: false })
@Transform((body) => {
return Array.isArray(body.value) ? body.value : [body.value];
})
types?: REPORT_BOOKMARK_TYPE[];
}