Skip to content

Commit f1bd43a

Browse files
committed
docs: GetCompanySearchList Swagger #35
1 parent 1f4237f commit f1bd43a

4 files changed

Lines changed: 28 additions & 14 deletions

File tree

src/main/java/sopt/comfit/company/controller/CompanyController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ public PageDto<GetCompanyListResponseDto> getCompanyList(@RequestParam(required
4141
return companyService.getCompanyList(keyword, industryEnum, scaleEnum, sortEnum, isRecruited, pageable);
4242
}
4343

44-
@GetMapping("/search")
45-
@SecurityRequirement(name= "JWT")
46-
public List<CompanySearchResponseDto> getCompanySearchList(@RequestParam String keyword){
44+
@Override
45+
public List<GetCompanySearchResponseDto> getCompanySearchList(@RequestParam String keyword){
4746

4847
return companyService.getCompanySearchList(keyword);
4948
}

src/main/java/sopt/comfit/company/controller/CompanySwagger.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
import org.springframework.web.bind.annotation.GetMapping;
1111
import org.springframework.web.bind.annotation.PathVariable;
1212
import org.springframework.web.bind.annotation.RequestParam;
13-
import sopt.comfit.company.dto.response.FeaturedCompanyResponseDto;
14-
import sopt.comfit.company.dto.response.GetCompanyListResponseDto;
15-
import sopt.comfit.company.dto.response.GetCompanyResponseDto;
16-
import sopt.comfit.company.dto.response.GetSuggestionCompanyResponseDto;
13+
import sopt.comfit.company.dto.response.*;
1714
import sopt.comfit.global.annotation.LoginUser;
1815
import sopt.comfit.global.dto.CommonApiResponse;
1916
import sopt.comfit.global.dto.CustomErrorResponse;
@@ -52,6 +49,26 @@ PageDto<GetCompanyListResponseDto> getCompanyList(@RequestParam(required = false
5249
@RequestParam(required = false) String sort,
5350
@RequestParam(defaultValue = "1") int page,
5451
@RequestParam(required = false) Boolean isRecruited);
52+
@Operation(
53+
summary = "기업 검색 API",
54+
description = "기업검색 API 입니다"
55+
)
56+
@ApiResponses({
57+
@ApiResponse(responseCode = "200", description = "기업 검색 성공",
58+
content = @Content(mediaType = "application/json",
59+
schema = @Schema(implementation = CommonApiResponse.class))),
60+
61+
@ApiResponse(responseCode = "403", description = "권한 오류",
62+
content = @Content(mediaType = "application/json",
63+
schema = @Schema(implementation = CustomErrorResponse.class))),
64+
@ApiResponse(responseCode = "401", description = "헤더값 오류",
65+
content = @Content(mediaType = "application/json",
66+
schema = @Schema(implementation = CustomErrorResponse.class)))
67+
})
68+
@GetMapping("/search")
69+
@SecurityRequirement(name= "JWT")
70+
List<GetCompanySearchResponseDto> getCompanySearchList(@RequestParam String keyword);
71+
5572

5673
@Operation(
5774
summary = "주요 기업 조회 API",

src/main/java/sopt/comfit/company/dto/response/CompanySearchResponseDto.java renamed to src/main/java/sopt/comfit/company/dto/response/GetCompanySearchResponseDto.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import sopt.comfit.company.domain.Company;
44

5-
public record CompanySearchResponseDto(
5+
public record GetCompanySearchResponseDto(
66
Long id,
77
String name
88
) {
9-
public static CompanySearchResponseDto from(Company company) {
10-
return new CompanySearchResponseDto(
9+
public static GetCompanySearchResponseDto from(Company company) {
10+
return new GetCompanySearchResponseDto(
1111
company.getId(),
1212
company.getName()
1313
);

src/main/java/sopt/comfit/company/service/CompanyService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package sopt.comfit.company.service;
22

33
import lombok.RequiredArgsConstructor;
4-
import org.springframework.data.domain.Page;
54
import org.springframework.data.domain.Pageable;
65
import org.springframework.stereotype.Service;
76
import org.springframework.transaction.annotation.Transactional;
8-
import org.springframework.web.bind.annotation.RequestParam;
97
import sopt.comfit.company.domain.*;
108
import sopt.comfit.company.dto.response.*;
119
import sopt.comfit.company.exception.CompanyErrorCode;
@@ -47,10 +45,10 @@ public PageDto<GetCompanyListResponseDto> getCompanyList( String keyword,
4745
}
4846

4947
@Transactional(readOnly = true)
50-
public List<CompanySearchResponseDto> getCompanySearchList(String keyword){
48+
public List<GetCompanySearchResponseDto> getCompanySearchList(String keyword){
5149

5250
return companyRepository.searchByKeyword(keyword).stream()
53-
.map(CompanySearchResponseDto::from)
51+
.map(GetCompanySearchResponseDto::from)
5452
.collect(Collectors.toList());
5553
}
5654

0 commit comments

Comments
 (0)