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';
|
2026-09-27 10:39:09 +03:30
|
|
|
import type { Actor } from '../common/record-scope';
|
|
|
|
|
import { ReportsDrilldownQueryDto, ReportsQueryDto } from './dto';
|
2026-08-29 21:06:30 +03:30
|
|
|
import { ReportsService } from './reports.service';
|
|
|
|
|
|
|
|
|
|
@Controller('reports')
|
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
|
|
|
export class ReportsController {
|
|
|
|
|
constructor(private readonly reportsService: ReportsService) {}
|
|
|
|
|
|
|
|
|
|
@Get('dashboard')
|
2026-09-27 10:39:09 +03:30
|
|
|
dashboard(@CurrentUser() user: Actor, @Query() query: ReportsQueryDto) {
|
|
|
|
|
return this.reportsService.dashboard(user, {
|
|
|
|
|
from: query.from,
|
|
|
|
|
to: query.to,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('drilldown')
|
|
|
|
|
drilldown(
|
|
|
|
|
@CurrentUser() user: Actor,
|
|
|
|
|
@Query() query: ReportsDrilldownQueryDto,
|
2026-08-29 21:06:30 +03:30
|
|
|
) {
|
2026-09-27 10:39:09 +03:30
|
|
|
return this.reportsService.drilldown(user, {
|
|
|
|
|
kind: query.kind,
|
|
|
|
|
id: query.id,
|
|
|
|
|
from: query.from,
|
|
|
|
|
to: query.to,
|
|
|
|
|
});
|
2026-08-29 21:06:30 +03:30
|
|
|
}
|
2026-09-01 15:21:54 +03:30
|
|
|
|
|
|
|
|
@Get('home')
|
2026-09-27 10:39:09 +03:30
|
|
|
home(@CurrentUser() user: Actor) {
|
|
|
|
|
return this.reportsService.home(user);
|
2026-09-01 15:21:54 +03:30
|
|
|
}
|
2026-08-29 21:06:30 +03:30
|
|
|
}
|