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 119 120 121 122 123 124 125 126 127 128 129 130 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Controller, Get, HttpStatus, Param, Patch, Query, UseGuards } from '@nestjs/common'; import { ApiBearerAuth, ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger'; import { JwtAuthGuard } from 'src/auth/guards/jwt-auth.guard'; 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 { ApiSuccessResponse } from 'src/commons/decorators/api-success-response.decorator'; import { CurrentUser } from 'src/commons/decorators/user.decorator'; import { LastItemIdResponseDto } from 'src/commons/dtos/last-item-id-response.dto'; import { ListResponseDto } from 'src/commons/dtos/list-response.dto'; import { UuidResponseDto } from 'src/commons/dtos/uuid-response.dto'; import { BadWordsPipe } from 'src/commons/pipe/badwords.pipe'; import { ApiSearchGetDetailResponseDto } from 'src/search/dto/api-search-get-detail-response.dto'; import { ApiSearchGetRecentResponseDto } from 'src/search/dto/api-search-get-recent-response.dto'; import { ApiSearchGetRequestQueryDto } from 'src/search/dto/api-search-get-request-query.dto'; import { ApiSearchGetResponseDto } from 'src/search/dto/api-search-get-response.dto'; import { SearchService } from 'src/search/search.service'; import { UserDto } from 'src/user/dto/user.dto'; @ApiTags('검색') @Controller('/api/search') export class SearchController { constructor(private readonly searchService: SearchService) {} @Get('') @UseGuards(JwtAuthGuard) @ApiBearerAuth('access-token') @ApiOperation({ summary: '검색', description: '검색', }) @ApiArraySuccessResponse(ApiSearchGetResponseDto, { description: '검색 성공', status: HttpStatus.OK, }) async getSearchPlace( @Query(BadWordsPipe) dto: ApiSearchGetRequestQueryDto, @CurrentUser() user: UserDto, ): Promise<LastItemIdResponseDto<ApiSearchGetResponseDto>> { return this.searchService.getSearchPlace(dto, user); } @Get('/popular') @ApiOperation({ summary: '인기 검색어 목록', description: '인기 검색어 목록', }) async getPopularSearches(): Promise<ListResponseDto<string>> { return this.searchService.getPopularSearches(); } @Get('/recent') @UseGuards(JwtAuthGuard) @ApiBearerAuth('access-token') @ApiOperation({ summary: '최근 검색어 목록', description: '최근 검색어 목록', }) async getRecentSearches( @CurrentUser() user: UserDto, ): Promise<ListResponseDto<ApiSearchGetRecentResponseDto>> { return this.searchService.getRecentSearches(user); } @Patch('/:uuid') @UseGuards(JwtAuthGuard) @ApiBearerAuth('access-token') @ApiOperation({ summary: '최근 검색어 삭제', description: '최근 검색어 삭제', }) @ApiSuccessResponse(UuidResponseDto, { description: '최근 검색어 삭제 완료', status: HttpStatus.NO_CONTENT, }) @ApiExceptionResponse([ERROR.NOT_EXIST_DATA], { description: '검색어 uuid가 존재하지 않을 경우', status: HttpStatus.NOT_FOUND, }) async deleteSearchLog( @Param('uuid') uuid: string, @CurrentUser() user: UserDto, ): Promise<UuidResponseDto> { return this.searchService.deleteSearchLog(uuid, user); } @Patch('/') @UseGuards(JwtAuthGuard) @ApiBearerAuth('access-token') @ApiOperation({ summary: '최근 검색어 전체 삭제', description: '최근 검색어 전체 삭제', }) @ApiSuccessResponse(UuidResponseDto, { description: '최근 검색어 전체 삭제 완료', status: HttpStatus.NO_CONTENT, }) @ApiExceptionResponse([ERROR.NOT_EXIST_DATA], { description: '최근 검색어가 하나도 존재하지 않을 경우', status: HttpStatus.NOT_FOUND, }) async deleteAllSearchLog(@CurrentUser() user: UserDto): Promise<UuidResponseDto> { return this.searchService.deleteAllSearchLog(user); } @Get('/place/:uuid') @ApiOperation({ summary: '검색 상세', description: '검색 상세', deprecated: true, }) @ApiSuccessResponse(ApiSearchGetDetailResponseDto, { 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 getSearchDetail(@Param('uuid') uuid: string): Promise<ApiSearchGetDetailResponseDto> { return this.searchService.getSearchDetail(uuid); } } |