All files / expertise expertise.controller.ts

100% Statements 29/29
83.33% Branches 5/6
100% Functions 3/3
100% Lines 29/29

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301x 1x 1x 1x 1x 1x 1x 1x 4x 4x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 2x 1x 1x 1x 1x 1x 3x 1x  
import { Controller, Get, HttpException, HttpStatus, Param } from "@nestjs/common";
import { ExpertiseException, ExpertiseService } from "./expertise.service";
import { ApiTags } from "@nestjs/swagger";
 
@ApiTags("expertise")
@Controller("expertise")
export class ExpertiseController {
    constructor(
        private readonly expertiseService: ExpertiseService
    ) { }
 
    @Get()
    async findAll() {
        return await this.expertiseService.findAll();
    }
 
    @Get(":title")
    async findOne(@Param("title") title: string) {
        try {
            return await this.expertiseService.findOne(title);
        } catch (e) {
            if (e instanceof ExpertiseException) {
                throw new HttpException(e.name, HttpStatus.NOT_FOUND);
            }
 
            throw e;
        }
    }
}