40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { Controller, Get, Query } from '@nestjs/common';
|
|
import { AdminDashboardService } from './admin-dashboard.service';
|
|
import { RequirePermission } from '../auth/guards';
|
|
|
|
/**
|
|
* Legacy endpoints:
|
|
* GET get-analytics -> views/DashboardECommerce.vue (wholesale)
|
|
* GET get-analytics-tak -> views/DashboardAnalytics.vue (retail)
|
|
*/
|
|
@Controller('admin/dashboard')
|
|
export class AdminDashboardController {
|
|
constructor(private readonly dashboard: AdminDashboardService) {}
|
|
|
|
@Get('omde')
|
|
@RequirePermission('dashboard.omde')
|
|
omde() {
|
|
return this.dashboard.omdeAnalytics();
|
|
}
|
|
|
|
@Get('tak')
|
|
@RequirePermission('dashboard.tak')
|
|
tak() {
|
|
return this.dashboard.takAnalytics();
|
|
}
|
|
|
|
/** Legacy views/report/order_item.vue. */
|
|
@Get('report/order-item')
|
|
@RequirePermission('report.order.item')
|
|
orderItemReport(@Query('start_date') from?: string, @Query('end_date') to?: string) {
|
|
return this.dashboard.orderItemReport(from, to);
|
|
}
|
|
|
|
/** Legacy views/report/product.vue. */
|
|
@Get('report/product')
|
|
@RequirePermission('report.product')
|
|
productReport(@Query('start_date') from?: string, @Query('end_date') to?: string) {
|
|
return this.dashboard.productReport(from, to);
|
|
}
|
|
}
|