Skip to content

Commit

Permalink
Merge pull request #31 from LikeLion-12th-SKHU/develop
Browse files Browse the repository at this point in the history
develop -> main push
  • Loading branch information
ttttkii913 authored Jul 24, 2024
2 parents 2ae4b3a + 09e0ac4 commit 9234a3e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ApiResponseTemplate<CurationInfoResDto> curationSave(@RequestBody Curatio
return ApiResponseTemplate.successResponse(curationInfoResDto, SuccessCode.CURATION_SAVE_SUCCESS);
}

@Operation(summary = "인증된 μ‚¬μš©μžκ°€ νλ ˆμ΄μ…˜ μˆ˜μ •", description = "인증된 μ‚¬μš©μžκ°€ νλ ˆμ΄μ…˜μ„ μˆ˜μ •ν•©λ‹ˆλ‹€.")
@Operation(summary = "인증된 μ‚¬μš©μžκ°€ νλ ˆμ΄μ…˜ μˆ˜μ •", description = "인증된 μ‚¬μš©μžκ°€ νλ ˆμ΄μ…˜μ„ μˆ˜μ •(νλ ˆμ΄μ…˜ 제λͺ©, μ„€λͺ…)ν•©λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "응닡 생성에 μ„±κ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€."),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­μž…λ‹ˆλ‹€."),
Expand Down Expand Up @@ -116,4 +116,16 @@ public ApiResponseTemplate<CurationListResDto> searchCurations(@RequestParam Str
// - 쀑, 쑰회-
// λžœλ”© νŽ˜μ΄μ§€ - κ²Œμ‹œκΈ€μ„ 많이 μž‘μ„±ν•œ 5λͺ…μ˜ νλ ˆμ΄ν„° 쑰회 κ°€λŠ₯

@Operation(summary = "λͺ¨λ“  μ‚¬μš©μžκ°€ μ’‹μ•„μš” 순으둜 μ •λ ¬λœ νλ ˆμ΄μ…˜ 6개 쑰회", description = "λͺ¨λ“  μ‚¬μš©μžκ°€ μ’‹μ•„μš” 순으둜 μ •λ ¬λœ νλ ˆμ΄μ…˜μ„ μ‘°νšŒν•©λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "응닡 생성에 μ„±κ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€."),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­μž…λ‹ˆλ‹€."),
@ApiResponse(responseCode = "500", description = "μ„œλ²„ λ‚΄λΆ€ 였λ₯˜μž…λ‹ˆλ‹€.")
})
@GetMapping("/popular")
@ResponseStatus(HttpStatus.OK)
public ApiResponseTemplate<CurationListResDto> findTop6ByOrderByLikeCountDesc() {
CurationListResDto curationListResDto = curationService.findTop6ByOrderByLikeCountDesc();
return ApiResponseTemplate.successResponse(curationListResDto, SuccessCode.GET_SUCCESS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,14 @@ public CurationListResDto curationFindAll(Pageable pageable) {
return CurationListResDto.from(curationInfoResDtoList);
}

// λͺ¨λ“  μ‚¬μš©μž - νλ ˆμ΄μ…˜ μ’‹μ•„μš” λ§Žμ€ 순으둜 6개만 쑰회
@Transactional
public CurationListResDto findTop6ByOrderByLikeCountDesc() {
List<Curation> curations = curationRepository.findTop6ByOrderByLikeCountDesc();
List<CurationInfoResDto> curationInfoResDtoList = curations.stream()
.map(CurationInfoResDto::from)
.toList();
return CurationListResDto.from(curationInfoResDtoList);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;
Expand All @@ -13,7 +14,10 @@ public interface CurationRepository extends JpaRepository<Curation, Long> {
Page<Curation> findAll(Pageable pageable);

Optional<Curation> findById(Long curationId);
// κ·Έλƒ₯ λžœλ€ν•˜κ²Œ 5개 쑰회

// μ’‹μ•„μš” 수 λ§Žμ€ 순으둜 νλ ˆμ΄μ…˜ 6개만 쑰회 (limit => sql, Curation c -> Jpql λ”°λΌμ„œ Curation c 라고 μ“°λ©΄ 쑰회 μ•ˆ 됨)
@Query(value = "SELECT * FROM Curation ORDER BY like_count DESC limit 6", nativeQuery = true)
List<Curation> findTop6ByOrderByLikeCountDesc();

// μ΅œμ‹ μˆœ 쑰회
// 인기순 쑰회
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ApiResponseTemplate<LocationListResDto> locationFindAll(Principal princip
return ApiResponseTemplate.successResponse(locationListResDto, SuccessCode.GET_SUCCESS);
}

@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ 생성", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.")
@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ 생성", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό 생성(νλ ˆμ΄μ…˜ id, μœ„μΉ˜ 이름, 이미지)ν•©λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "응닡 생성에 μ„±κ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€."),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­μž…λ‹ˆλ‹€."),
Expand All @@ -57,7 +57,7 @@ public ApiResponseTemplate<LocationInfoResDto> locationSave(@RequestPart("locati
return ApiResponseTemplate.successResponse(locationInfoResDto, SuccessCode.LOCATION_SAVE_SUCCESS);
}

@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ μˆ˜μ •", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό μˆ˜μ •ν•©λ‹ˆλ‹€.")
@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ μˆ˜μ •", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό μˆ˜μ •(μœ„μΉ˜ 이름, 이미지)ν•©λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "응닡 생성에 μ„±κ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€."),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­μž…λ‹ˆλ‹€."),
Expand All @@ -73,7 +73,7 @@ public ApiResponseTemplate<LocationInfoResDto> locationUpdate(@PathVariable("loc
return ApiResponseTemplate.successResponse(locationInfoResDto, SuccessCode.LOCATION_UPDATE_SUCCESS);
}

@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ μ‚­μ œ.", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό μ‚­μ œν•©λ‹ˆλ‹€.")
@Operation(summary = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜ μ‚­μ œ", description = "인증된 μ‚¬μš©μžκ°€ μœ„μΉ˜λ₯Ό μ‚­μ œν•©λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "응닡 생성에 μ„±κ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€."),
@ApiResponse(responseCode = "400", description = "잘λͺ»λœ μš”μ²­μž…λ‹ˆλ‹€."),
Expand Down

0 comments on commit 9234a3e

Please sign in to comment.