2026-08-29 21:06:30 +03:30
|
|
|
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
|
|
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
|
|
|
import { CurrentUser } from '../auth/current-user.decorator';
|
|
|
|
|
import { ReportsQueryDto } from './dto';
|
|
|
|
|
import { ReportsService } from './reports.service';
|
|
|
|
|
|
|
|
|
|
@Controller('reports')
|
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
|
|
|
export class ReportsController {
|
|
|
|
|
constructor(private readonly reportsService: ReportsService) {}
|
|
|
|
|
|
|
|
|
|
@Get('dashboard')
|
|
|
|
|
dashboard(
|
|
|
|
|
@CurrentUser()
|
|
|
|
|
user: { userId: string; organizationId: string; role: string },
|
|
|
|
|
@Query() query: ReportsQueryDto,
|
|
|
|
|
) {
|
|
|
|
|
return this.reportsService.dashboard(
|
|
|
|
|
{
|
|
|
|
|
userId: user.userId,
|
|
|
|
|
organizationId: user.organizationId,
|
|
|
|
|
role: user.role,
|
|
|
|
|
},
|
|
|
|
|
{ from: query.from, to: query.to },
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-09-01 15:21:54 +03:30
|
|
|
|
|
|
|
|
@Get('home')
|
|
|
|
|
home(
|
|
|
|
|
@CurrentUser()
|
|
|
|
|
user: { userId: string; organizationId: string; role: string },
|
|
|
|
|
) {
|
|
|
|
|
return this.reportsService.home({
|
|
|
|
|
userId: user.userId,
|
|
|
|
|
organizationId: user.organizationId,
|
|
|
|
|
role: user.role,
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-08-29 21:06:30 +03:30
|
|
|
}
|