import { Controller, Get } from '@nestjs/common'; import { ApiBearerAuth, ApiOkResponse, ApiTags } from '@nestjs/swagger'; import { CurrentUser } from '../auth/decorators/current-user.decorator'; import { RequirePermission } from '../auth/decorators/require-permission.decorator'; import type { AuthenticatedUser } from '../auth/types/authenticated-user'; import { AutopilotTodayDto } from './dto/next-steps-response.dto'; import { NextStepsService, type AutopilotToday } from './next-steps.service'; @ApiTags('autopilot') @ApiBearerAuth() @Controller('autopilot') export class AutopilotTodayController { constructor(private readonly nextSteps: NextStepsService) {} /** * "Today": the most urgent step over all colonies, the due inspections * per apiary, the number of open suggestions and the season per apiary. * Tasks and suggestions only with `tasks:read`. */ @ApiOkResponse({ type: AutopilotTodayDto }) @RequirePermission('colonies:read') @Get('today') today(@CurrentUser() actor: AuthenticatedUser): Promise { return this.nextSteps.today(actor.id); } }