-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathadmin.controller.ts
More file actions
30 lines (27 loc) · 1.02 KB
/
admin.controller.ts
File metadata and controls
30 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @fileoverview Controller for admin-only endpoints.
* @issue #206
*/
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
import { AdminService } from './admin.service';
import { AdminGuard } from './guards/admin.guard';
import {
AdminDashboardQueryDto,
AdminDashboardResponseDto,
} from './dto/dashboard.dto';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
@ApiTags('Admin')
@Controller('admin')
@UseGuards(AdminGuard)
export class AdminController {
constructor(private readonly adminService: AdminService) {}
@Get('dashboard')
@ApiOperation({ summary: 'Get platform-wide analytics for the admin dashboard' })
@ApiResponse({ status: 200, description: 'Successfully retrieved dashboard data.', type: AdminDashboardResponseDto })
@ApiResponse({ status: 403, description: 'Forbidden. User is not an admin.' })
getDashboardAnalytics(
@Query() query: AdminDashboardQueryDto,
): Promise<AdminDashboardResponseDto> {
return this.adminService.getDashboardAnalytics(query);
}
}