mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:41:09 +02:00
- Move finance, mail, moodlit to apps-archived for later development - Rename games/voxel-lava to games/voxelava 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { Controller, Get, Query, UseGuards, ParseIntPipe, DefaultValuePipe } from '@nestjs/common';
|
|
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
|
|
import { ReportService } from './report.service';
|
|
|
|
@Controller('reports')
|
|
@UseGuards(JwtAuthGuard)
|
|
export class ReportController {
|
|
constructor(private readonly reportService: ReportService) {}
|
|
|
|
@Get('dashboard')
|
|
getDashboard(@CurrentUser() user: CurrentUserData) {
|
|
return this.reportService.getDashboard(user.userId);
|
|
}
|
|
|
|
@Get('monthly-summary')
|
|
getMonthlySummary(
|
|
@CurrentUser() user: CurrentUserData,
|
|
@Query('year', new DefaultValuePipe(new Date().getFullYear()), ParseIntPipe) year: number,
|
|
@Query('month', new DefaultValuePipe(new Date().getMonth() + 1), ParseIntPipe) month: number
|
|
) {
|
|
return this.reportService.getMonthlySummary(user.userId, year, month);
|
|
}
|
|
|
|
@Get('category-breakdown')
|
|
getCategoryBreakdown(
|
|
@CurrentUser() user: CurrentUserData,
|
|
@Query('startDate') startDate: string,
|
|
@Query('endDate') endDate: string,
|
|
@Query('type') type?: 'income' | 'expense'
|
|
) {
|
|
return this.reportService.getCategoryBreakdown(user.userId, startDate, endDate, type);
|
|
}
|
|
|
|
@Get('trends')
|
|
getTrends(
|
|
@CurrentUser() user: CurrentUserData,
|
|
@Query('months', new DefaultValuePipe(6), ParseIntPipe) months: number
|
|
) {
|
|
return this.reportService.getTrends(user.userId, months);
|
|
}
|
|
|
|
@Get('cash-flow')
|
|
getCashFlow(
|
|
@CurrentUser() user: CurrentUserData,
|
|
@Query('startDate') startDate: string,
|
|
@Query('endDate') endDate: string
|
|
) {
|
|
return this.reportService.getCashFlow(user.userId, startDate, endDate);
|
|
}
|
|
}
|