68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
Param,
|
|
Post,
|
|
Put,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
|
import { Public } from 'src/core/guards';
|
|
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
|
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 await this.service.create(body);
|
|
}
|
|
|
|
@Get()
|
|
async getAll(@Query() query: GetReportBookmarkDto) {
|
|
return await this.service.getAll(query);
|
|
}
|
|
|
|
// @Get(':id')
|
|
// async get(@Param('id') id: string) {
|
|
// return await this.service.getOne(id);
|
|
// }
|
|
|
|
@Get('label-history')
|
|
async getAllLabelHistory(@Query() query: GetLabelReportBookmarkDto) {
|
|
return await this.service.getAllLabelHistory(query);
|
|
}
|
|
|
|
@Get('applied')
|
|
async currentApplied(@Query() query: GetLabelReportBookmarkDto) {
|
|
return await this.service.getCurrentAppliedBookmark(query);
|
|
}
|
|
|
|
@Put('applied/:id')
|
|
async applied(@Param('id') id: string) {
|
|
return await this.service.applied(id);
|
|
}
|
|
|
|
@Put('unapplied/:id')
|
|
async unapplied(@Param('id') id: string) {
|
|
return await this.service.unapplied(id);
|
|
}
|
|
|
|
@Delete(':id')
|
|
async delete(@Param('id') id: string) {
|
|
return await this.service.delete(id);
|
|
}
|
|
}
|