| Total Complexity | 1 | 
| Complexity/F | 1 | 
| Lines of Code | 26 | 
| Function Count | 1 | 
| Duplicated Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import {Controller, Inject, UseGuards, Query, Get} from '@nestjs/common'; | ||
| 2 | import {AuthGuard} from '@nestjs/passport'; | ||
| 3 | import {ApiUseTags, ApiBearerAuth, ApiOperation} from '@nestjs/swagger'; | ||
| 4 | import {IQueryBus} from 'src/Application/IQueryBus'; | ||
| 5 | import {GetMonthlyEventsQuery} from 'src/Application/FairCalendar/Query/GetMonthlyEventsQuery'; | ||
| 6 | import {MonthlyEventsDTO} from './DTO/MonthlyEventsDTO'; | ||
| 7 | |||
| 8 | @Controller('events') | ||
| 9 | @ApiUseTags('Event') | ||
| 10 | @ApiBearerAuth() | ||
| 11 | @UseGuards(AuthGuard('bearer')) | ||
| 12 | export class GetMonthlyActivitiesAction { | ||
| 13 | constructor( | ||
| 14 |     @Inject('IQueryBus') | ||
| 15 | private readonly queryBus: IQueryBus | ||
| 16 |   ) {} | ||
| 17 | |||
| 18 | @Get() | ||
| 19 |   @ApiOperation({title: 'Get monthly events by user'}) | ||
| 20 |   public async index(@Query() dto: MonthlyEventsDTO) { | ||
| 21 | return await this.queryBus.execute( | ||
| 22 | new GetMonthlyEventsQuery(new Date(dto.date), dto.userId) | ||
| 23 | ); | ||
| 24 | } | ||
| 25 | } | ||
| 26 |