File size: 551 Bytes
96ed566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Get, Controller, BadRequestException } from '@nestjs/common';
import { GetStatisticsUseCase } from '@/domain/alcremie/application/use-cases/cases/get-statistics/get-statistics';

@Controller('status')
export class GetStatusController {
  constructor(private readonly getStatisticsUseCase: GetStatisticsUseCase) {}

  @Get()
  async getStatus() {
    const result = await this.getStatisticsUseCase.execute({});

    if (result.isLeft()) {
      throw new BadRequestException();
    }

    return {
      statistics: result.value,
    };
  }
}