feat: setup api for get label history on bookmark #10

Merged
firmanr merged 1 commits from feat/report into development 2024-07-03 05:22:20 +00:00
7 changed files with 110 additions and 17 deletions

View File

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

View File

@ -1,5 +1,31 @@
import { Injectable } from '@nestjs/common';
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()
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()
export class ReportService extends BaseReportService {
async getReportConfig(query: GetReportConfigDto) {
return this.getUser();
return 'you hit API for get report config';
}
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()
applied: boolean;
@ApiProperty({ name: 'type', required: true })
@IsBoolean()
@ApiProperty({
name: 'type',
required: true,
default: REPORT_BOOKMARK_TYPE.TABLE_CONFIG,
})
@IsString()
type: REPORT_BOOKMARK_TYPE;
@ApiProperty({

View File

@ -21,3 +21,23 @@ export class GetReportBookmarkDto {
})
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[];
}