| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 28 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Controller, Inject, UseGuards, Get } from '@nestjs/common'; |
||
| 2 | import { AuthGuard } from '@nestjs/passport'; |
||
| 3 | import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; |
||
| 4 | import { IQueryBus } from 'src/Application/IQueryBus'; |
||
| 5 | import { Roles } from 'src/Infrastructure/User/Decorator/Roles'; |
||
| 6 | import { RolesGuard } from 'src/Infrastructure/User/Security/RolesGuard'; |
||
| 7 | import { UserRole } from 'src/Domain/User/User.entity'; |
||
| 8 | import { GetShippingCostsQuery } from 'src/Application/Order/Query/ShippingCost/GetShippingCostsQuery'; |
||
| 9 | import { ShippingCostView } from 'src/Application/Order/View/ShippingCostView'; |
||
| 10 | |||
| 11 | @Controller('shipping-costs') |
||
| 12 | @ApiTags('Order') |
||
| 13 | @ApiBearerAuth() |
||
| 14 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
| 15 | export class GetShippingCostsAction { |
||
| 16 | constructor( |
||
| 17 | @Inject('IQueryBus') |
||
| 18 | private readonly queryBus: IQueryBus |
||
| 19 | ) {} |
||
| 20 | |||
| 21 | @Get() |
||
| 22 | @Roles(UserRole.PHOTOGRAPHER) |
||
| 23 | @ApiOperation({summary: 'Get all shipping costs'}) |
||
| 24 | public async index(): Promise<ShippingCostView[]> { |
||
| 25 | return await this.queryBus.execute(new GetShippingCostsQuery()); |
||
| 26 | } |
||
| 27 | } |
||
| 28 |