Files
hr-portal/app/backend/src/departments/departments.controller.ts
T
TenX PM 87e9346d62 feat: complete HR portal full-stack application
- NestJS backend with 11 modules: Auth, Employees, Departments, Attendance, Leaves, Payroll, Reimbursements, Announcements, Tax, Reports, Admin
- JWT authentication with refresh tokens, role-based access (employee/hr_admin/super_admin)
- MongoDB schemas with Mongoose for all entities
- PDF payslip generation with pdfkit
- OpenTelemetry tracing to SigNoz
- Automatic database seeding on first startup
- Next.js 14 frontend with App Router, Tailwind CSS
- 25 pages covering all employee, HR admin, and super admin workflows
- Multi-stage Dockerfile with nginx proxy
- test-manifest.json for E2E testing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 19:32:52 +00:00

36 lines
1.1 KiB
TypeScript

import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { RolesGuard } from '../common/guards/roles.guard';
import { Roles } from '../common/decorators/roles.decorator';
import { DepartmentsService } from './departments.service';
import { CreateDepartmentDto, UpdateDepartmentDto } from './dto/department.dto';
@Controller('departments')
@UseGuards(JwtAuthGuard, RolesGuard)
export class DepartmentsController {
constructor(private departmentsService: DepartmentsService) {}
@Get()
findAll() {
return this.departmentsService.findAll();
}
@Post()
@Roles('hr_admin')
create(@Body() dto: CreateDepartmentDto) {
return this.departmentsService.create(dto);
}
@Put(':id')
@Roles('hr_admin')
update(@Param('id') id: string, @Body() dto: UpdateDepartmentDto) {
return this.departmentsService.update(id, dto);
}
@Delete(':id')
@Roles('hr_admin')
remove(@Param('id') id: string) {
return this.departmentsService.remove(id);
}
}