All files / place place.controller.ts

100% Statements 30/30
100% Branches 0/0
100% Functions 6/6
100% Lines 28/28

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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 1194x 4x 4x 4x 4x 4x 4x     4x 4x 4x 4x 4x 4x 4x 4x 4x       4x 16x                     4x     1x                                             4x     1x                       4x     1x                       4x     1x                                           4x 1x      
import { Controller, Get, HttpStatus, Param, Query } from '@nestjs/common';
import { ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
import { ERROR } from 'src/commons/constants/error';
import { ApiArraySuccessResponse } from 'src/commons/decorators/api-array-success-response.decorator';
import { ApiExceptionResponse } from 'src/commons/decorators/api-exception-response.decorator';
import { ApiPagingSuccessResponse } from 'src/commons/decorators/api-paging-success-response.decorator';
import { ApiSuccessResponse } from 'src/commons/decorators/api-success-response.decorator';
import { CursorPaginatedResponseDto } from 'src/commons/dtos/cursor-paginated-response.dto';
import { ListResponseDto } from 'src/commons/dtos/list-response.dto';
import { ApiPlaceGetCultureDetailResponseDto } from 'src/place/dto/api-place-get-culture-detail-response.dto';
import { ApiPlaceGetCultureRequestQueryDto } from 'src/place/dto/api-place-get-culture-request-query.dto';
import { ApiPlaceGetCultureResponseDto } from 'src/place/dto/api-place-get-culture-response.dto';
import { ApiPlaceGetDetailResponseDto } from 'src/place/dto/api-place-get-detail-response.dto';
import { ApiPlaceGetExhibitionRequestQueryDto } from 'src/place/dto/api-place-get-exhibition-request-query.dto';
import { ApiPlaceGetExhibitionResponseDto } from 'src/place/dto/api-place-get-exhibition-response.dto';
import { ApiPlaceGetPopupRequestQueryDto } from 'src/place/dto/api-place-get-popup-request-query.dto';
import { ApiPlaceGetPopupResponseDto } from 'src/place/dto/api-place-get-popup-response.dto';
import { PlaceService } from 'src/place/place.service';
 
@ApiTags('장소')
@Controller('/api/place')
export class PlaceController {
  constructor(private readonly placeService: PlaceService) {}
 
  @Get('/culture')
  @ApiOperation({
    summary: '전시/팝업 간편 목록',
    description: '전시/팝업 간편 목록',
  })
  @ApiArraySuccessResponse(ApiPlaceGetCultureResponseDto, {
    description: '전시/팝업 간편 목록 조회 성공',
    status: HttpStatus.OK,
  })
  async findCultureList(
    @Query() dto: ApiPlaceGetCultureRequestQueryDto,
  ): Promise<ListResponseDto<ApiPlaceGetCultureResponseDto>> {
    return this.placeService.findCultureList(dto);
  }
 
  @Get('/culture/:uuid')
  @ApiOperation({
    summary: '전시/팝업 상세',
    description: '전시/팝업 상세',
    deprecated: true,
  })
  @ApiSuccessResponse(ApiPlaceGetCultureDetailResponseDto, {
    description: '전시/팝업 상세 조회 성공',
    status: HttpStatus.OK,
  })
  @ApiExceptionResponse([ERROR.NOT_EXIST_DATA], {
    description: '장소 uuid가 존재하지 않는 경우',
    status: HttpStatus.NOT_FOUND,
  })
  @ApiParam({
    name: 'uuid',
    type: 'string',
    required: false,
    description: '장소 uuid',
  })
  async findCultureDetail(
    @Param('uuid') uuid: string,
  ): Promise<ApiPlaceGetCultureDetailResponseDto> {
    return this.placeService.findCultureDetail(uuid);
  }
 
  @Get('/exhibition')
  @ApiOperation({
    summary: '전시소개 목록',
    description: '전시소개 목록',
  })
  @ApiPagingSuccessResponse(ApiPlaceGetExhibitionResponseDto, {
    description: '전시소개 목록 조회 성공',
    status: HttpStatus.OK,
  })
  async findExhibitionList(
    @Query() dto: ApiPlaceGetExhibitionRequestQueryDto,
  ): Promise<CursorPaginatedResponseDto<ApiPlaceGetExhibitionResponseDto>> {
    return this.placeService.findExhibitionList(dto);
  }
 
  @Get('/popup')
  @ApiOperation({
    summary: '팝업소개 목록',
    description: '팝업소개 목록',
  })
  @ApiPagingSuccessResponse(ApiPlaceGetPopupResponseDto, {
    description: '팝업소개 목록 조회 성공',
    status: HttpStatus.OK,
  })
  async findPopupList(
    @Query() dto: ApiPlaceGetPopupRequestQueryDto,
  ): Promise<CursorPaginatedResponseDto<ApiPlaceGetPopupResponseDto>> {
    return this.placeService.findPopupList(dto);
  }
 
  @Get('/:uuid')
  @ApiOperation({
    summary: '장소 상세',
    description: '장소 상세',
  })
  @ApiSuccessResponse(ApiPlaceGetDetailResponseDto, {
    description: '장소 상세 조회 성공',
    status: HttpStatus.OK,
  })
  @ApiExceptionResponse([ERROR.NOT_EXIST_DATA], {
    description: '장소 uuid가 존재하지 않는 경우',
    status: HttpStatus.NOT_FOUND,
  })
  @ApiParam({
    name: 'uuid',
    type: 'string',
    required: false,
    description: '장소 uuid',
  })
  async findPlaceDetail(@Param('uuid') uuid: string): Promise<ApiPlaceGetDetailResponseDto> {
    return this.placeService.findPlaceDetail(uuid);
  }
}