import { Controller, Get, Post, Body, Patch, Param, Delete, Req, UseGuards, Put, } from '@nestjs/common'; import { SystemService } from './system.service'; import { CreateSystemDto } from './dto/create-system.dto'; import { UpdateSystemDto } from './dto/update-system.dto'; import { AuthenticatedRequest } from 'src/model/interface/authenticated-request.interface'; import { AuthGuard } from 'src/core/guards/auth.guard'; @UseGuards(AuthGuard) @Controller('system') export class SystemController { constructor(private readonly systemService: SystemService) {} @Post() create( @Req() req: AuthenticatedRequest, @Body() createSystemDto: CreateSystemDto, ) { return this.systemService.create(req.user, createSystemDto); } @Get() findAll(@Req() req: AuthenticatedRequest) { return this.systemService.findAll(req.user); } @Get('archive') findDeleted(@Req() req: AuthenticatedRequest) { return this.systemService.findDeleted(req.user); } @Get(':id/manager') getManagers(@Param('id') id: string) { return this.systemService.getManagers(id); } @Post(':id/manager') manaManager(@Param('id') id: string, @Body() body: any){ return this.systemService.manageManagers(id, body); } @Get(':id') findOne(@Param('id') id: string) { return this.systemService.findOne(id); } @Put() update(@Req() req: AuthenticatedRequest, @Body() updateSystemDto: UpdateSystemDto) { return this.systemService.update(req.user, updateSystemDto); } @Delete(':id') remove(@Param('id') id: string) { return this.systemService.remove(id); } @Put(':id/restore') restoreKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) { return this.systemService.restore(req.user, id); } }