87e9346d62
- 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>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { Controller, Get, Post, Body, Param, Query, UseGuards, Res } from '@nestjs/common';
|
|
import { Response } from 'express';
|
|
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
|
|
import { RolesGuard } from '../common/guards/roles.guard';
|
|
import { Roles } from '../common/decorators/roles.decorator';
|
|
import { CurrentUser } from '../common/decorators/current-user.decorator';
|
|
import { PayrollService } from './payroll.service';
|
|
import { GeneratePayrollDto } from './dto/payroll.dto';
|
|
|
|
@Controller()
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
export class PayrollController {
|
|
constructor(private payrollService: PayrollService) {}
|
|
|
|
@Post('payroll/generate')
|
|
@Roles('hr_admin')
|
|
generate(@Body() dto: GeneratePayrollDto, @CurrentUser() user: any) {
|
|
return this.payrollService.generatePayroll(dto, user._id.toString());
|
|
}
|
|
|
|
@Get('payroll')
|
|
@Roles('hr_admin')
|
|
findPayrollRuns(@Query() query: any) {
|
|
return this.payrollService.findPayrollRuns(query);
|
|
}
|
|
|
|
@Get('payslips')
|
|
findPayslips(@Query() query: any, @CurrentUser() user: any) {
|
|
return this.payrollService.findPayslips(query, user);
|
|
}
|
|
|
|
@Get('payslips/:id')
|
|
findPayslipById(@Param('id') id: string) {
|
|
return this.payrollService.findPayslipById(id);
|
|
}
|
|
|
|
@Get('payslips/:id/pdf')
|
|
async downloadPdf(@Param('id') id: string, @Res() res: Response) {
|
|
return this.payrollService.generatePdf(id, res);
|
|
}
|
|
}
|