import { Body, Controller, HttpCode, HttpStatus, Inject, Post, Query, Req, UseGuards, } from '@nestjs/common'; import { ActivityLogService } from '../service/activity-log.service'; import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard'; @Controller('/activity-log') @UseGuards(JwtAuthGuard) export class ActivityLogController { constructor( @Inject('ActivityLogService') private readonly activityLogService: ActivityLogService, ) {} @Post('/get-all-activity-log') @HttpCode(HttpStatus.OK) async getAllActivityLog( @Req() req: Request & { user: any }, @Body('entity_type') mapped_entity_type: string, @Body('mapped_entity_id') mapped_entity_id: string, @Query('category') category: string, ) { const loggedInUser = req.user.userData; const result = this.activityLogService.getAllActivityLog( mapped_entity_type, mapped_entity_id, category, loggedInUser, ); return result; } @Post('/get-all-activity-category') @HttpCode(HttpStatus.OK) async getAllActivityCategory( @Req() req: Request & { user: any }, @Body('entity_type') mapped_entity_type: string, @Body('mapped_entity_id') mapped_entity_id: string, ) { const loggedInUser = req.user.userData; const result = this.activityLogService.getAllActivityCategory( mapped_entity_id, mapped_entity_type, loggedInUser, ); return result; } }